Click here to Skip to main content
16,020,313 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I created a form with my custom login design.
It will check the database for entered username and password and it will move to next page when the provided details are available.
Its working well. But, now i struck in a situation to logout.
When i write Script using Javascript or ASP.NET coding, it will make it to move to home page. But, browser history is available and when we press back button it was getting into the page again.
Please help me..
Posted

this is asked at least five times a day and is documented all over the web. If you write your pages properly then any page will fail to load if you try to refresh it. But, you also need to turn off browser caching to stop a cached verson being available.

Add these lines in the html meta section

<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<META HTTP-EQUIV="EXPIRES" CONTENT="0">

and in the page_load write this

Response.Cache.SetCacheability(HttpCacheability.NoCache);
 
Share this answer
 
 
Share this answer
 
Comments
Christian Graus 12-Jul-11 5:25am    
Note - you should NEVER try to disable the back button. It is easily defeated, and if someone relies on this as a form of security, their site is very unsecure indeed.

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