FormsAuthentication.SignOut non funziona su Firefox 3 (asp.net)
-
10-07-2019 - |
Domanda
Sto usando questo codice nella pagina di accesso. Questo funziona benissimo.
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");
Ma quando esco utilizzando FormsAuthentication.SignOut o asp: il controllo LoginStatus non esegue il logout. questo sembra aver effettuato l'accesso. Quando eseguo i test su Internet Explorer 8, questo si disconnette correttamente.
Cosa sta succedendo su Firefox? Come posso risolvere questo problema?
Grazie
ebattulga
Soluzione
Il problema con FireFox e FormsAuthentication è che FireFox non sembra eliminare il cookie di autenticazione su SignOut. 3 cose che puoi provare:
1) Dopo aver chiamato il metodo SignOut, cancella i cookie in questo modo = > Response.cookies.clear ()
2) Prova a chiamare Session.abandon
prima della tua chiamata SignOut
3) Puoi anche provare quanto segue: Response.Expires = 0, Response.Cache.SetNoStore (), Response.AppendHeader (" Pragma " ;, " no-cache ")
Spero che aiutino!