Im developing a small web application used on a shared computer.
When the user closes the browser window, I want the session and authentication to be deleted.
On the login page, I use something like this to authenticate the user:
FormsAuthenticationTicket authTicket =
new FormsAuthenticationTicket(1,txtUser.Text,
DateTime.Now,
DateTime.Now.AddMinutes(5),
false,"");
string encTicket = FormsAuthentication.Encrypt(authTicket);
HttpCookie faCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encTicket);
HttpContext.Current.Response.Cookies.Add(faCookie);
string redirectUrl = FormsAuthentication.GetRedirectUrl(txtUser.Text, false);
HttpContext.Current.Response.Redirect(redirectUrl);
As you can see, I set the variable "isPersistent" to false.
This seems to work on Chrome (not tested in IE), however, when I launch the application in Firefox, when I activate several tabs, if I close the browser and open again, I'm still authenticated, and the cookie is still there!
This is really strange, because the cookie should be deleted when closing ... Is this a bug from Firefox when you have multiple tabs open? How can i fix this?
Help is much appreciated!