FormsAuthentication.SignOut don't work on the firefox 3 (asp.net)

眉间皱痕 提交于 2019-12-08 10:06:49

问题


I'm using this code in login page. This is work fine.

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");

But when i logout using FormsAuthentication.SignOut or asp:LoginStatus control this is don't logout. this seems logged on. When i testing on the internet explorer 8, this successfully logout.

What happing on the firefox? How can i do fix this problem?

Thanks

ebattulga


回答1:


The problem with FireFox and FormsAuthentication is that FireFox doens't seem to delete the auth cookie on SignOut. 3 things you can try:

1) After calling the SignOut method, clear the cookies like this => Response.cookies.clear()
2) Try calling Session.abandon before your SignOut call
3) You can also try the following: Response.Expires = 0, Response.Cache.SetNoStore(), Response.AppendHeader("Pragma", "no-cache")

Hope those help!



来源:https://stackoverflow.com/questions/1220523/formsauthentication-signout-dont-work-on-the-firefox-3-asp-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!