After logout, back button in browser should not open the secured page visited earlier.

7. March 2013

Solution to this problem is
We have to add these four lines in every page ( which you want to make not cacheable ) . I have added these lines in Masterpage on OnInit() function.

protected override void OnInit(EventArgs e)
{
Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1));
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetAllowResponseInBrowserHistory(false);
Response.Cache.SetNoStore();
base.OnInit(e);
}

ASP.NET ,

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading