我在登录页面中使用此代码。这很好。

FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(
               1, // Ticket version
               eUserName.Text,
               DateTime.Now, 
               DateTime.Now.AddMinutes(30),
               true,
               "administrator",
               FormsAuthentication.FormsCookiePath);


        string hash = FormsAuthentication.Encrypt(ticket);
        HttpCookie cookie = new HttpCookie(
           FormsAuthentication.FormsCookieName,
           hash);

        // Set the cookie's expiration time to the tickets expiration time
        if (ticket.IsPersistent) cookie.Expires = ticket.Expiration;

        // Add the cookie to the list for outgoing response
        Response.Cookies.Add(cookie);
        Response.Redirect("Default.aspx");

但是当我使用FormsAuthentication.SignOut或asp:LoginStatus控件注销时,这是不要注销。这似乎登录了。当我在Internet Explorer 8上测试时,这次成功注销。

在firefox上有什么好评? 我该如何解决这个问题?

由于

ebattulga

有帮助吗?

解决方案

FireFox和FormsAuthentication的问题是FireFox似乎没有删除SignOut上的auth cookie。你可以尝试3件事:

1)在调用SignOut方法后,清除像这样的Response.cookies.clear() <>的cookie; Session.abandon结果 2)尝试在SignOut呼叫之前拨打Response.Expires = 0, Response.Cache.SetNoStore(), Response.AppendHeader("Pragma", "no-cache") 3)您还可以尝试以下方法:<=>

希望那些帮助!

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top