Click here to Skip to main content
15,881,600 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
i have to disable back button f my browser. I tried many codes searched in google. but its not working for all browsers. Can anyone help me to find the correct code for it?
Posted
Updated 8-Apr-18 6:16am

 
Share this answer
 
Comments
Aswathi Narayan 22-Aug-11 7:11am    
Thank u 4 ur reply.. But i have to disable it in every page of my project. How can i do this?
Pravin Patil, Mumbai 22-Aug-11 7:18am    
Nice link..
My 5....
D-Kishore 29-Aug-12 7:05am    
Its nice
Please have a look at my answer to a similar question earlier

How to disable back,forward and Refresh functionality in browser?[^]

In short, don't disable the back button - it's not yours to disable. If you're trying to do this because your application 'needs it', then your architecture and general approach is probably incorrect

"..But i have to disable it in every page of my project. How can i do this?"

Why would you ever need to do this? What about if you were on codeproject now and you couldn't use back or any navigation functions, wouldn't you be annoyed?!

If you really want to stop users being able to go back, you could use an approach similar to this link

http://www.codeguru.com/csharp/.net/net_debugging/debugging/article.php/c12891[^]
 
Share this answer
 
Have a look at this,

http://aspnetstudymaterials.blogspot.in/2011_11_01_archive.html[^]

You have to paste the code in the master page or all of your pages...
Thank you...
 
Share this answer
 
Check out :

1. http://www.htmlgoodies.com/tutorials/buttons/article.php/3478911/Disabling-the-Back-Button.htm[^]
2. http://csharpdotnetfreak.blogspot.com/2009/04/disable-browser-back-button-javascript.html[^]
3. http://www.4guysfromrolla.com/webtech/111500-1.shtml[^]
4. http://www.irt.org/script/311.htm[^]

You can write this functionality on the page where you want back button disabled. If you want all the pages to have back button disabled then the same function can be written in Master Page.
 
Share this answer
 
you can check prevoius page via server[page_referrer] in your page, redirect to error page if the previous page is not your desired one.
 
Share this answer
 
Just use this code into your Page Load Event:
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetExpires(DateTime.UtcNow.AddHours(-1));
Response.Cache.SetNoStore();
 
Share this answer
 
XML
Add this script:

<script>history.go(1)</script>

on Head section of page. Hope this will help you
 
Share this answer
 
Comments
member60 28-Apr-12 5:57am    
!

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