Using the browser back arrow

G

Guest

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
 
G

Guest

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.NoCache);
Response.Cache.SetExpires(DateTime.Now-new TimeSpan(1,0,0));
Response.Cache.SetLastModified(DateTime.Now);
Response.Cache.SetAllowResponseInBrowserHistory(false);
}

Sreejith
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top