This is common requirement for all the web application to disable back
button of browser after log-out. But there is no direct method or
property to disable back button of browser. This only depends on browser
cache or history, if browser contains any history or cache then back
button will be active after log-out also.
Here I am explaining - How to disable back button of browser?
This can be possible using only after clearing history or cache of browser.
or
Don't allow browser to keep history or cache.
For this we can add this code for all the pages to which we don't want to allow cache.
Here is code-
protected void Page_Load(object sender, EventArgs e)
{
Response.Buffer = true;
Response.ExpiresAbsolute = DateTime.Now.AddDays(-1d);
Response.Expires = -1000;
Response.CacheControl = "no-cache";
}
In this code, I am written code to disallowing browser to cache the page. So that even after browsing the page browser will not keep page as cache or history.
This code should be included for all the pages.
Here I am explaining - How to disable back button of browser?
This can be possible using only after clearing history or cache of browser.
or
Don't allow browser to keep history or cache.
For this we can add this code for all the pages to which we don't want to allow cache.
Here is code-
protected void Page_Load(object sender, EventArgs e)
{
Response.Buffer = true;
Response.ExpiresAbsolute = DateTime.Now.AddDays(-1d);
Response.Expires = -1000;
Response.CacheControl = "no-cache";
}
In this code, I am written code to disallowing browser to cache the page. So that even after browsing the page browser will not keep page as cache or history.
This code should be included for all the pages.
No comments:
Post a Comment