简体   繁体   English

我为什么可以通过浏览器的后退按钮导航到页面,尽管cache = disable?

[英]Why can I navigate to a page via browser's back button though cache = disabled?

I have set in my mastersite of my asp.net application the following that the browser does not cache the pages and the user cannot navigate via back (and forward) buttons; 我在asp.net应用程序的主站点中设置了以下内容:浏览器不缓存页面,并且用户无法通过后退(和前进)按钮进行导航;

    Response.Cache.SetCacheability(HttpCacheability.NoCache)
    Response.Cache.SetExpires(Now.AddSeconds(-1))
    Response.Cache.SetNoStore()
    Response.AppendHeader("Pragma", "no-cache")

It's working on every site, but not on the first (that appears after a successful login). 它可以在每个站点上运行,但不能在第一个站点上运行(成功登录后会出现)。

If I navigate from the startpage to a random page and use the browser's back button, the back-transfer works. 如果我从起始页面导航到随机页面并使用浏览器的后退按钮,则后退传输有效。 If I navigate from a random page to another random page it is not working. 如果我从一个随机页面导航到另一个随机页面,则无法正常工作。

In which cases the no cache option does not "disable" the browser's back button? 在哪种情况下, no cache选项不会“禁用”浏览器的后退按钮?

no-cache does not disable the back button. no-cache不会禁用后退按钮。 It only disables the cache. 它仅禁用缓存。 The url history is still maintained. 网址历史记录仍然保留。 'No caching' only means that when you go back, the page will be reloaded from the server and not from the cache. “不缓存”仅意味着当您返回时,将从服务器而不是从缓存重新加载页面。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM