Author: rollercoaster | Posted on: 7/24/2008 9:27:06 AM | Views : 433

Hi all,
I have made a helper class to encrypt and decrypt a cookie. If I encode and right after decode the cookie using it everything is successful but if i encrypt and add the cookie to the Response and then try to decrypt in another page , the decryption fails as somehow the value strings get corrupted or changed in the trip to/from the client.

public static HttpCookie EncodeCookie(HttpCookie cookie)
{
HttpCookie eCookie = new HttpCookie(cookie.Name);
for (int i = 0; i < cookie.Values.Count; i++)
{
string value = HttpContext.Current.Server.UrlEncode(Encode(cookie.Values[i], Key, AlgorithmName));
string name = HttpContext.Current.Server.UrlEncode(Encode(cookie.Values.GetKey(i), Key, Algori ...

Go to the complete details ...