Thursday, June 11, 2009

Clear cache to load the page when browser back button is clicked

C# Code

in the Page_load

Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetExpires(DateTime.Now.AddSeconds(-1));
Response.Cache.SetNoStore();

Using javascript we can disable the browser back event.Whenever user clicks back button it show the previous button and again redirect to current page.

javascript code


function disableBackButton()
{
window.history.forward();
}
setTimeout("disableBackButton()", 0);

No comments:

Post a Comment