代码:
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解码,但得到的是乱码,看来是加过密的,有办法解密吗?
九州编程
泛舟湖上清波郎朗