Some time its happen after logging out when you are clicking on the back button its redirect to the previous page which one should open if the browser is holding the session. To prevent this a simple solution I found. Three lines of code that can solve your problem in a minute.
Code:
Copy the code and paste into your project and test it. It will redirect to your login page. Enjoy...
Code:
protected void Page_Load(object sender, EventArgs e) { /* Starts here */ Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.Cache.SetExpires(DateTime.Now.AddDays(-1)); Response.Cache.SetNoStore(); /* Ends here */ if (Session["User"] == null) Response.Redirect("login.aspx"); }
Copy the code and paste into your project and test it. It will redirect to your login page. Enjoy...