Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hello guys.. Im using Session.Abandon() to logout from a page and then redirecting to Logout.aspx. But when I use the Back button of IE 8, it takes me back to that page which I think it should not. What is wrong with this?? thnx
Here is what I have done
Session.Abandon();
Response.Redirect("Logout.aspx");
Posted
Updated 17-Mar-11 8:24am
v2
Comments
Albin Abel 17-Mar-11 14:30pm    
Session will be recreated when requesting a page. In your case you may need to set the session login flag to null. Otherwise the cookie will help the session create successfully. Otherwise use a cookie-less session
Sergey Alexandrovich Kryukov 20-Mar-11 23:14pm    
I don't think it's really working...
--SA

Browsers back button does not reload the page until you force it. It fetches the code from cache and hence you are able to view the last page again.

This tip should help you out: Browser back button issue after logout[^]
 
Share this answer
 
Comments
TweakBird 17-Mar-11 14:33pm    
Good answer. 5+
Albin Abel 17-Mar-11 14:39pm    
This is correct. 5
Espen Harlinn 18-Mar-11 5:06am    
Good one, my 5
Sergey Alexandrovich Kryukov 20-Mar-11 23:14pm    
Agree, a 5.
--SA
Put this in the PageLoad method of the Logout page (I *think* it might do the trick):

C#
Response.Cache.SetCacheability(HttpCacheability.NoCache);   
Response.Cache.SetExpires(DateTime.Now.AddSeconds(-1));   
Response.Cache.SetNoStore();   
Response.AppendHeader("Pragma", "no-cache"); 
 
Share this answer
 
v2
Comments
Albin Abel 17-Mar-11 14:40pm    
Needed settings. 5
AmbiguousName 17-Mar-11 15:18pm    
Right...I dont know but I think thats why it does not work. I dont know which settings to modify.
Hi

Go through this CP Article, Exploring Session in ASP.Net[^]. I hope this will clear all your queries.

P.S: After reading of this article, Analyze your self, what have to do in this type of situations. Still if you didn't get solution for your 'Back button of IE8' post a comment here.

Thanks
Eswar
 
Share this answer
 
Comments
Albin Abel 17-Mar-11 14:40pm    
good link. 5
AmbiguousName 17-Mar-11 15:06pm    
Hi there...I used Page Level disabling session in Logout.aspx but it did not work.
Use Session["Name"] = null
and Session.clear()
 
Share this answer
 
The best solution to end the session and invalidate the user Login is to use the ASP.NET LoginStatus Control. It works fine and here are the steps for help: http://dotnet-programming-solutions.blogspot.com/2013/01/aspnet-sessionabandon-doesnt-work-not.html[^]
 
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