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.
Unfortunately, activation email could not send to your email. Please try again.

Disable refresh and back button on the browser

Thread ID:

Created:

Updated:

Platform:

Replies:

42577 Apr 1,2006 05:36 AM Apr 3,2006 03:56 AM ASP.NET Web Forms (Classic) 2
loading
Tags: FAQ
rohit
Asked On April 1, 2006 05:36 AM

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

Administrator [Syncfusion]
Replied On April 3, 2006 12:04 AM

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

rohit
Replied On April 3, 2006 03:56 AM

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 > >

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;