Browser Back Button Working After Logout from Asp.Net application

  ASP.NET   Wednesday, September 24, 2014   7069 | No Comments Yet!!! | Not Downloaded Yet!!! | No Demo | Pawan Kumar
 Tags: Browser Back Button Working  After Logout from Asp.Net application  Browser Back Button  Logout  

While begin logout from the 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

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

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" "">

"Head1" runat="server">
        "Cache-Control" content="no-cache" />
        "Pragma" content="no-cache" />
        "Expires" content="0" />

    "form1" runat="server">

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

Post Comments

if you have some suggestion, question, request on Browser Back Button Working After Logout from Asp.Net application.

Please use the comment box to express your views.