When browser back button clicked, the page is loaded from users cache.. one
way is to expire the first page , so that when the user clicks back button
from second page, the browser shows a message that page is not available,
forcing them to use the navigation provided in the site ..
private void Page_Load(object sender, System.EventArgs e)
{
ExpirePageCache();
//.......rest of the page_load logic....................
}
/// <summary>
/// This function prevent the page being retrieved from broswer cache
/// </summary>
private void ExpirePageCache()
{
Response.Cache.SetCacheability(HttpCacheability.No Cache);
Response.Cache.SetExpires(DateTime.Now-new TimeSpan(1,0,0));
Response.Cache.SetLastModified(DateTime.Now);
Response.Cache.SetAllowResponseInBrowserHistory(fa lse);
}
Sreejith
"Denise" wrote:
> In my application, I am setting cookies used for other pages based on the
> current row selected. But when the user presses the 'back' button, the
> pageload event does not get called and the record they are viewing does not
> match the cookie and can lead to data entry errors. Is there a way to
> resolve this?
>
> Thanks,
> Denise
|