Click here to Skip to main content
15,559,491 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:

i want's the solution of below problem ,
user login into site then while he is logoff ,his a/c must be close
but while i press the back button of exploror the a/c of existing user will open.

1 solution

Add these following 3 lines in Page_Load event of all the pages.

HttpContext.Current.Response.AddHeader("Cache-Control", "no-cache, no-store, max-age=0, must-revalidate");
            HttpContext.Current.Response.AddHeader("Pragma", "no-cache");
            HttpContext.Current.Response.AddHeader("Expires", "Fri, 01 Jan 1990 00:00:00 GMT");

What it does is, it asks the browser to not to cache the page. so when user hits the back button, browser will always get the new page from the server.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900