有办法在浏览器端取到服务器端设置的身份验证Cookie吗?

代码:

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解码,但得到的是乱码,看来是加过密的,有办法解密吗?


当年话下
浏览 516回答 2
2回答

九州编程

主要是没想过要把它解密

泛舟湖上清波郎朗

办法总是有的 ,可是我不会,关注一下,呵呵。
打开App,查看更多内容
随时随地看视频慕课网APP