Click here to Skip to main content
15,899,126 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to disable browser back bottun after logout.
Posted
Comments
Nelek 1-Apr-12 14:52pm    
Why to disable the back button? You can check if logged in when opening/reacharging page and if not redirect to the login page.

1 solution

Hi,

it's not possible to completly remove back button function. But there are several workarounds out there.
Please read this solution:

http://www.irt.org/script/311.htm[^]

An important point from SAKryukov (in my words):

Such blocking of the Back Button with Javascript can be tricked out.
You should carefully check at loading your Login-Page if user credentials are valid and the forms-authentication ticket gets removed (FormsAuthentication.SingOut Method), in case they're not valid, redirect them).
Useful links for understanding Authentication(settings description for your IIS-Server and ASP.NET Login Controls) and states:

SignOut() method
http://msdn.microsoft.com/de-de/library/system.web.security.formsauthentication.signout.aspx[^]

Authentication:
http://msdn.microsoft.com/en-us/library/eeyk640h.aspx[^]

States:
http://msdn.microsoft.com/en-us/library/75x4ha6s.aspx[^]

If you want preventing that "last" data of page is shown to users when hitting back button after logout, don't cache the protected pages and also check credentials, otherwise redirect them. As said, this script is an addition to the much more important "basic" security settings.



With Best Regards
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 1-Apr-12 16:03pm    
That is correct, my 5.

I would add that a developer should never rely on any technique preventing loading any content by any URL and not on disabled cache. All those limitation can be worked around.

Instead, the problem should be solved at the level of functionality. The effect of the user request should depend on the state and detail like authentication.

--SA
El_Codero 1-Apr-12 18:56pm    
Hope it's ok for you to improve it within my solution. Agree with you,op should really take care of righ authentication, but some point it unclear for me as you wrote "not to disable the cache". For my understanding it's needed to prevent shown last data when hitting back button?With Best Regards

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