I am using Mozila fire fox as browser and I want to stop back button of an my asp.net webpage what i can do??
I tried the window.history.back(1) but it is not working
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Suthish NairPosted Mar 24, 2011, 2:34 PM
Suthish NairPosted Mar 22, 2011, 12:14 PM
Andrew FensterPosted Mar 22, 2011, 11:27 AM
Is so, you're asking all the same questions everyone else asks. Unfortunately, there's NO good fix. You can try to block the back button with client side Javascript. Even if you succeeded in coming up with Javascript to override the user's effort to use the back button, they have other options. They can modify or turn off your Javascript. They can use the browser history to go back instead. You can't completely block the user from seeing the last cached page in the browser with Javascript. You can make it harder, but you can't stop it.
If you really want security, you have to put this in your code:
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetExpires(DateTime.Now); //or a date much earlier than current time
This keeps the browser from caching your page. YOur performance is worse, but it's the only way to really secure your page. The user can still hit the back button, but there's nothing cached for the user to see when he goes back.