FormsAuthentication.SignOut(); Session.Abandon(); // clear authentication cookie HttpCookie cookie1 = new HttpCookie(FormsAuthentication.FormsCookieName, ""); cookie1.Expires = DateTime.Now.AddYears(-1); Response.Cookies.Add(cookie1); cookie1.Path = FormsAuthentication.FormsCookiePath; cookie1.HttpOnly = true; // clear session cookie (not necessary for your current problem but i would recommend you do it anyway) HttpCookie cookie2 = new HttpCookie("ASP.NET_SessionId", ""); cookie2.Expires = DateTime.Now.AddYears(-1); Response.Cookies.Add(cookie2); FormsAuthentication.RedirectToLoginPage();
world wide web development problems asp net php html xhtml css javascript jquery w3dproblems
Thursday, January 23, 2014
How to log the user out using FormsAuthentication.SignOut()
Labels:
asp net
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment