Author: jgn1013 | Posted on: 8/26/2010 8:33:26 PM | Views : 288

When closing my tab, Formsauthentication doesn't clear, thanks!


protected void Login1_Authenticate(object sender, AuthenticateEventArgs e) { if (Classes.CStaticDataAccess.AuthenticateUser(Login1.UserName, Login1.Password)) { FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, Login1.UserName, DateTime.Now, DateTime.Now.AddMinutes(1), false, ""); string secureTicket = FormsAuthentication.Encrypt(ticket); HttpCookie authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, secureTicket); Response.Cookies.Add(authCookie); string redirectUrl = FormsAuthentication.GetRedirectUrl(Login1.UserName, false); HttpContext.Current.Response.Redirect(redirectUrl); // System.Web.Security.FormsAuthentication.SetAuthCookie(Login1.UserName, false); e.Authenticated = true; } else { e.Authen ...

Go to the complete details ...