We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Disable refresh and back button on the browser

How to disable refresh and back button of browser in asp.net?

2 Replies

AD Administrator Syncfusion Team April 3, 2006 04:04 AM UTC

Hi Rohit, 1)One of the best Method is Kill the session using Session.Abondon(); once user is logged out 2)Another way is to write a javascript function which reads value of a hidden field, say isLoggedIn, and if found false, forwards the page by using window.history.forward(1), so that the effect of the back button is reset. The isLoggedIn hidden field will be set to true or 1 when the user logs in and it will be set to false or 0 when a user logs out. This script should be incorporated in the header of every aspx page and every page should have a hidden field like isLoggedIn. 3)The code is hope the above details will help you Thanks, Hari


RO rohit April 3, 2006 07:56 AM UTC

Hi saw ur reply... i have disabdled the back button with history.forward. But I still have no idea about refresh button or F5. Actually I have a count down timer on the webpage in javascript which works fine but gets restarted when the page is refreshed. Thats happening because on load event is called when we press refresh button. thanks rohit >Hi Rohit, > >1)One of the best Method is Kill the session using Session.Abondon(); once user is logged out > >2)Another way is to write a javascript function which reads value of a hidden field, say isLoggedIn, and if found false, forwards the page by using window.history.forward(1), so that the effect of the back button is reset. > >The isLoggedIn hidden field will be set to true or 1 when the user logs in and it will be set to false or 0 when a user logs out. > >This script should be incorporated in the header of every aspx page and every page should have a hidden field like isLoggedIn. > >3)The code is > > > >hope the above details will help you > >Thanks, >Hari > >

Loader.
Live Chat Icon For mobile
Up arrow icon