using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; public partial class log_out : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1)); Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.Cache.SetNoStore(); } protected void Timer1_Tick(object sender, EventArgs e) { string redirectUrl = FormsAuthentication.LoginUrl + "?ReturnUrl=log_in_form.aspx"; FormsAuthentication.SignOut(); ////FormsAuthentication.SignOut(); //Session.Abandon(); //// clear authentication cookie //HttpCookie cookie1 = new HttpCookie(FormsAuthentication.FormsCookieName, ""); //cookie1.Expires = DateTime.Now.AddYears(-1); //Response.Cookies.Add(cookie1); //// 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(); Response.Redirect(redirectUrl); } }