I am saving a cookie using a value from a database and then accessing that cookie on another page. i noticed that if the cookie has a ; in it's value, it is cut off at that ;. How do I fix this other than changing the data so it does not include ;?
+1
A:
That is a limitation of http. You will have to encode the cookie value like this
string cookieValue = Server.UrlEncode(someValue);
and decoding is
string someValue = Server.UrlDecode(cookieValue);
Daniel A. White
2009-04-13 23:32:00
+1
A:
Semi-colons are special characters when it comes to cookies. You'll have to encode its value in the cookie somehow.
Since you're using ASP.NET, it should be as easy as calling:
cookieString = HttpUtility.UrlEncode(cookieString);
John Rasch
2009-04-13 23:34:11