Click here to Skip to main content
15,439,515 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I have a page that includes a 'Logout' button, when the user clicks 'Logout', I perform the Session.Abandon() and redirect to Login.aspx. This clears all my session variables fine.

But, if I then click the back button in the browser, the last page before clicking 'Logout' is rendered again. I believe this is due to caching. As when I includes the following code when loading the page, this problem will not occur.
Response.AddHeader("Cache-control", "no-store, must-revalidate, private,no-cache");
Response.AddHeader("Pragma", "no-cache");
Response.AddHeader("Expires", "0");

However, this piece of code will disable the cache for my page.
I do not want to disable cache for my pages because it slows down the performance considerably. I just want to find a way to clear the cache ONLY when the user clicks the 'Logout' menu item.
Can anyone help with this?
Posted
Updated 27-Jan-11 20:44pm
v2

1 solution

Check out this Tips from Code Project
Browser back button issue after logout[^]
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 28-Jan-11 2:48am     CRLF
Good answer - a 5. I just voted for Sandeep's article. --SA
soni uma 28-Jan-11 2:58am    
This code is not full all browser supported. It is better to handle catch issue at coding side.
Abhijit Jana 28-Jan-11 4:23am    
What do you mean by coding side ? How this things will work for Browser ?

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