Tuesday, February 2, 2010

How to restrict back button in 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));

No comments: