Tuesday, January 19, 2010

Disable Back Button

Force the previous page to expire. This solution isn't about disabling the Back button but selecting pages that you don't want the user to return to. When you force a page to expire then, when the user hits the Back button and returns to the page, the browser is forced to go back to the server to retrieve the page -- this gives your server-side code a chance to run.

This directive, added to a page in Source view, will do the job on most browsers:

‹%@ OutputCache location="none" Duration="1" VaryByParam="none" %›
You also do it from code by calling the SetCacheability method:

Reponse.Cache.SetCacheability(HttpCacheability.NoCache)
for more read this

No comments: