Browser Back Button Working After Logout from Asp.Net application
3 Comments |
4256 Views | Post by: Admin
Browser Back Button Working, After Logout from Asp.Net application,Browser Back Button,Logout
While begin logout from the asp.net web application a use can still move to the previous page using the browsers back button.
While begin logout from the asp.net web application a use can still move to the previous page using the browsers back button.During the log out event, Session is cleared and caching is disabled but the previous page is still shown. So, how can we work around this?
All browsers provide the History Option to go back to previous visited web pages(both forward and backward). The browser cache the visidted page and the History butons- backward and forward is used to to move from oder visted pages to newer visited page.
So, to fix this type of issue, we need to make sure that page do not get cahced. I'm showing to method to resolve this issue.
Option 1 - Code behind
public partial class option_one : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)
Option 2 - Works on any page
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="option-two.aspx.cs" Inherits="option_two" %>
"-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
"Cache-Control" content="no-cache" />
"Pragma" content="no-cache" />
"Expires" content="0" />
In the above code, you can paste the code in the master page for the authenticated pages or alternatively, if there is no fixed master page for authenticated pages - then, it needs to be places on all all required pages.
so, we have learned and resolve the issue related with Browser Back Button Working After Logout from Asp.Net application
Download Source Codes