什么条件导致Web浏览器显示"Page Expired"消息?

Ric*_*lls 5 browser asp.net

我假设发送一个有效期的页面(a la)...

    Response.Cache.SetExpires(System.DateTime.Now.AddSeconds(5));
    Response.Cache.SetCacheability(HttpCacheability.Public);
    Response.Cache.SetValidUntilExpires(true);
Run Code Online (Sandbox Code Playgroud)

...意味着如果用户点击后退按钮,他们会看到"Page Expired"消息.它似乎没有那样工作.我发现使用后退按钮只会显示旧的(IMO已过期)页面.事实上,在试验缓存/非缓存和到期时间的不同组合时,我从未设法从浏览器中获取"页面已过期"消息.

什么条件激起了这个信息?

服务器环境ASP .Net.我只在IE8中测试过 - 我假设其他浏览器在这里是一致的.

小智 1

您可以尝试设置这些附加响应标头:

Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 
Pragma: no-cache
Run Code Online (Sandbox Code Playgroud)

但是,我认为没有任何可靠的方法可以强制所有浏览器不从历史记录中重新加载页面。