Pages

Friday, June 15, 2012

reading cookie in asp .net set by coldfusion

1. cookie has special characters
2. unable to read cookie  in asp.net set by coldfusion
3. how to replace special characters in cookie coldfusion asp.net
4. replace special characters in cfcookie

:) this was a good issue for us. we have two application, one in coldfusion and other in asp.net

Coldfusion application was setting a cookie and that cookie was supposed to read by asp.net application. 
cookie set by coldfusion was url encoded and it was having %2b characters for "+" sign so when asp.net was reading cookie as %2b signs so we were not able to validate users based on cookie read by asp.net application.

so at last we figured out this and found browser is storing cookie in url encoded format and asp.net application needs to decode cookie.

we used below code in asp.net to decode cookie set by coldfusion.



cookieValue= HttpUtility.UrlDecode(myCookie.Value);


 Few tips:
1. always use F12 developer tool to see all set cookie in internet explorer. 


finally we solved problem :)
 

1 comment:

  1. It has nothing to do with coldfusion, Browser alwayz keeps the cookie value in encoded format.

    ReplyDelete