且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ASP.Net Web窗体是否有任何Http缓存?

更新时间:2023-02-15 18:21:16

实际上 OutputCache指令用于客户端作为服务器端缓存。当您将该指令的位置设置为 Any 时, Client 下游 ServerAndClient ,设置适当的缓存响应标头,以使浏览器或代理不会请求同一页面再次提供网页的缓存版本。但是请记住,这些客户端可以***地再次请求这些页面。

Actually the OutputCache directive is used for both Client as Server side caching. When you set the Location of that directive to Any, Client, Downstream or ServerAndClient, proper cache response headers are set such that browsers or proxies won't request the same page again and serve the cached version of your page. But keep in mind that those clients are free to request those pages again.

在设置指令后,具有Cache-Control标头的位置选项:
<%@ OutputCache Location = XXX Duration = 60 VaryByParam = none%>

Location options with their Cache-Control headers after setting directive: <%@ OutputCache Location="XXX" Duration="60" VaryByParam="none" %>


  • 客户:私人,最高年龄= 60

  • 下游:公共,最高年龄= 60

  • 任何:公共

  • ServerAndClient :私有,最大年龄= 60

  • 服务器:无缓存

  • 无输出指令:私有

  • Client: private, max-age=60
  • Downstream: public, max-age=60
  • Any: public
  • ServerAndClient: private, max-age=60
  • Server: no-cache
  • No output directive: private