2013-04-10 37 views
2

我们有一个现有的ASP.Net Web窗体应用程序安装在每个客户端自己的服务器上。这已经使用了他们所有了一段时间,从来没有真正有一个问题,我们现在有一些人通过一个iPad登录时谁得到的错误:Asp.Net Web窗体在iPad上出现票证错误

invalid value for encrypted ticket parameter 

我们的iPad在这里进行测试,我们不要”不会得到错误,尽管让他们确保在Safari浏览器设置中接受cookie,甚至要求他们在iPad上试用Chrome并没有什么区别。不能复制它使诊断非常困难,所以我希望以前有人可能有这个问题。

它使用Forms身份验证和自定义MembershipProvider。

+0

http://forums.asp.net/t/1800205.aspx/1 – Fabio 2013-04-10 09:08:16

回答

0

如果您将无效字符串传递给System.Web.Security.FormsAuthentication.Decrypt,则会发生这种情况。最常见的是它试图通过cookieName而不是cookieValue

以下是获得ASPXAUTH cookie值+信息的方式:

string authCookieValue = HttpContext.Request.Cookies[FormsAuthentication.FormsCookieName].Value; 
var cookieInfo = System.Web.Security.FormsAuthentication.Decrypt(authCookieValue); 
0

你必须检查的HttpCookie空,也为它的价值如下。

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 

     } 
    }