问题
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