Backbutton webbrowser + expired content = refresh
I have the following in my .Net code:
Response.Cache.SetCacheability(HttpCacheability.NoCache)
开发者_JAVA技巧
When the users use the back button of Internet Explorer, they get a content expired warning. They need to hit F5 to reload the page.
Can I make adjustments so there is no caching, but with an automatic refresh so the warning isn't displayed?
Regards,
M.
That 'Content Expired' warning usually comes up when the page attempting to be reloaded was the result of a POST
request. For normal GET
requests in the history, the browser would simply issue another request for it.
This is one reason why the Post-Redirect-Get pattern is such a good pattern to use for POST
requests: The Redirect removes the actual POST result page from the browser's history, replacing it with the page you redirect them to. (Actually, it doesn't remove anything at all - when the browser gets the 'redirect', it simply puts the page it was redirected to into the history instead of the original POST
page)
This should go with the principle of 'idempotent gets', where your GET
requests should never do anything destructive (so that the default behavior of web browsers simply re-requesting those GET pages from history isn't a bad thing.
精彩评论