什么是
- HttpCacheability.NoCache
- HttpCacheability.Server
- HttpCacheability.Public
- HttpCacheability.Private
- HttpCacheability.ServerAndNoCache
它们之间有何不同?在哪种情况下应使用哪个?
什么是
它们之间有何不同?在哪种情况下应使用哪个?
来自MSDN
设置Cache-Control:no-cache头。如果没有字段名,指令应用于整个请求,共享(代理服务器)缓存必须在满足请求之前强制使用原始Web服务器进行成功的重新验证。有了字段名,指令仅适用于命名字段;响应的其余部分可以从共享缓存中提供。
默认值。 设置Cache-Control:private以指定响应仅可由客户端缓存,而不是共享(代理服务器)缓存缓存。
设置Cache-Control:public以指定响应可由客户端和共享(代理)缓存缓存。
指定响应仅在源服务器上缓存。类似于NoCache选项。客户端接收到Cache-Control:no-cache指令,但文档被缓存在源服务器上。相当于 ServerAndNoCache。
将Server和NoCache的设置应用于指示内容在服务器上被缓存,但所有其他人都明确禁止缓存响应。
指示响应在服务器和客户端上都被缓存,但其他地方不允许代理服务器缓存响应。
ServerAndPrivate
。 - Jamie ReesNoCache: nobody can cache the page.
Private: only browsers can cache it (but not shared proxies). This is the default value
Public: everybody can cache the page, proxies included
Server: pages are cached only on the server (like the NoCache, so browsers don't cache the page)
ServerAndNoCache: pages are cached only on the server (like the NoCache, so browsers don't cache the page)
ServerAndPrivate: only browsers can cache it (but not shared proxies).
您可以在这里阅读更多:
http://codeclimber.net.nz/archive/2007/04/01/Beware-the-ASP.NET-SetCacheability-method.aspx