Thursday, October 22, 2009

how to restrict back button using asp.net.

We have come across the problem while clicking on the back button in the browser.

we shouldn't load the page again when we click on the back button.

Below code it will hide the back button. This is also one of the security leavl have to

follow in the transaction pages.

Response.Buffer = true;
Response.CacheControl = "no-cache";
Response.Cache.SetNoStore();
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetExpires(DateTime.Now.AddDays(-1));