Click here to Skip to main content
15,920,651 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Session.Abandon(); 
Session["AnotherSession"] = null;
Session["MyName"] = "SomeName"


Sometimes we come across the scenario that on log off if you call Session.Abandon() method and you press Browser back button it will take you to the previous visited page and will show all the value in the web page which session object holds earlier.
How to solve this type of problems?
Posted
Updated 31-Dec-10 23:48pm
v2

This good tip will help you.

Browser back button issue after logout[^]
 
Share this answer
 
This worked for me:
C#
Session.clear();//clear session
Session.Abandon();//Abandon session
Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1));
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetNoStore();
 
Share this answer
 
Im not sure,but try this,I hope it will help you.
Session.Remove("AnotherSession"); 

insted of
Session.Abandon();
Session["AnotherSession"] = null;
 
Share this answer
 
v2

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