代码:
FormsAuthenticationTicket authTicket = new
FormsAuthenticationTicket(1,
userInfo.UserName,
DateTime.Now,
DateTime.Now.AddMinutes(HttpContext.Current.Session.Timeout),
false,
roles);
string encryptedTicket = FormsAuthentication.Encrypt(authTicket);
HttpCookie authCookie =
new HttpCookie(FormsAuthentication.FormsCookieName,
encryptedTicket);
if (string.Compare(SolutionConfig.CookieDomain, "null", true) != 0)
authCookie.Domain = SolutionConfig.CookieDomain;
System.Web.HttpContext.Current.Response.Cookies.Add(authCookie);
然后在客户端用一个javascript个函数对Cookie做Base64解码,但得到的是乱码,看来是加过密的,有办法解密吗?
主要是没想过要把它解密
办法总是有的 ,可是我不会,关注一下,呵呵。