views:

125

answers:

2

I assumed that sending a page out with an expiry (a la)...

    Response.Cache.SetExpires(System.DateTime.Now.AddSeconds(5));
    Response.Cache.SetCacheability(HttpCacheability.Public);
    Response.Cache.SetValidUntilExpires(true);

...would mean that if the user hit the back button they would see the "Page Expired" message. It does not seem to work that way. I found that using the back button would simply show the old (IMO expired) page. In fact in experimenting with different combinations of caching/not caching and expiry times I NEVER managed to get the "Page Expired" message out of the browser.

What conditions provoke that message?

Server Environment ASP .Net. I've only tested in IE8 - I'm assuming that other browsers are consistent here.

A: 

I think what you are after is the message that are displayed when trying to reload/refresh (or back) a page that you have posted data to (with a POST request in oppose to a GET), therefor, since the POST-data might be "old" information, you recieve that warning.

jishi
Thanks, but no. I think that is the message that says "To display the webpage again, Internet Explorer needs to resend the information you've previously submitted...". That's not what I'm thinking of. I believe (am I just wrong here?) that there is a message claiming that the page has expired. I seem unable to provoke that message so I could just be barking up the wrong tree.
RichardHowells
+1  A: 

You can try to set these additional response headers:

Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 
Pragma: no-cache

However, I don't think there's any reliable way to force all browsers to not reload a page from history.

Rob Cooney