我们有一个现有的ASP.Net Web Forms应用程序,它安装在每个客户端自己的服务器上。这已经被他们所有人使用了一段时间了,从来没有真正出现过问题,我们现在有一些人在通过iPad登录时得到了错误:
invalid value for encrypted ticket parameter我们在这里测试iPads,我们没有得到错误,尽管让他们确保cookie在safari设置中被接受,甚至要求他们在iPad上试用Chrome也没有什么不同。不能复制它使得诊断变得非常困难,所以我希望有人以前可能有过这个问题。
它使用带有自定义MembershipProvider的表单身份验证。
发布于 2014-03-11 06:41:17
如果您将无效的字符串传递给System.Web.Security.FormsAuthentication.Decrypt,就会发生这种情况。最常见的情况是,它试图传入cookieName而不是cookieValue。
下面是获取ASPXAUTH cookie值+info的方法:
string authCookieValue = HttpContext.Request.Cookies[FormsAuthentication.FormsCookieName].Value;
var cookieInfo = System.Web.Security.FormsAuthentication.Decrypt(authCookieValue);发布于 2014-07-19 14:09:12
你必须检查HttpCookie的null和它的值,如下所示。
HttpCookie authCookie = System.Web.HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName];
if (authCookie != null)
{
//Extract the forms authentication cookie
if (!string.IsNullOrEmpty(authCookie.Value))
{
FormsAuthenticationTicket authTicket = FormsAuthentication.Decrypt(authCookie.Value);
string email = authTicket.UserData;
// and now process your code as per your condition
}
}https://stackoverflow.com/questions/15921451
复制相似问题