使用此方法创建Cookie,存储的实际值为:
87B0B98C-3108-4367-B8EF-5A7D35F65E1D
但cookie中显示的实际值是:
34D20FCCC8F39594FAEA6B924535EA19834AEBE9F91D859D530735C06EDBFF5DD22CC0DCDD99FB164B8079CE00D420DEB18B209E2894D2F53A39F8352A1E3661A887259047E29E9D67755336E09B32D60C0226219EFDD0D5EE8DE48356AF6502A8752E6EA2FB3C737474F4A471EC9C181858A4D83748C9F55B4F20F6946F1F9B6F8B9E4E73717BF87F0C04F828A9C543BFA87C88CC5095C5F31570377C55EB88CF0E3E42
我的问题是,如何将Cookie中的值转换为实际值(如果您尝试在没有.net的情况下访问它)
或者这是一个你无法绕过的加密层吗?
答案 0 :(得分:1)
我认为这就是你要找的。 p>
string userData = "ApplicationSpecific data for this user.";
FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1,
username,
DateTime.Now,
DateTime.Now.AddMinutes(30),
isPersistent,
userData,
FormsAuthentication.FormsCookiePath);
// Encrypt the ticket.
string encTicket = FormsAuthentication.Encrypt(ticket);
// Create the cookie.
Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, encTicket));
http://msdn.microsoft.com/en-us/library/system.web.security.formsauthenticationticket.aspx
encTicket包含您需要的值。