本文介绍了ASP.Net Web窗体是否有任何Http缓存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ASP.Net Web窗体应用程序。博客文章提到 Output Caching 使用 HttpRuntime.Cache 在后台-因此不是 HTTP缓存。该请求到达服务器,并从服务器发送缓存的响应(当有效的缓存输出在服务器上可用时)。因此,整个内容都是通过网络发送的。

I have an ASP.Net Web Forms application. The blog post "CacheCow Series - Part 0: Getting started and caching basics" mentions that Output Caching uses HttpRuntime.Cache behind the scene -hence not HTTP caching. The request reaches the server and cached response is sent from the server (when the valid cached output is avaialble on the server). So the entire content is sent across the wire.

ASP.Net Web Forms是否有任何HTTP缓存可用(如果缓存的话,响应内容不是从服务器发送的)是有效的;但是客户端(仅)从服务器获取了有效性信息后,客户端会从HTTP缓存中获取它?)

Is there any HTTP Caching available for ASP.Net Web Forms (where response content is not sent from the server, if cache is valid; but the client takes it from it's HTTP Cache after getting validity information (only) from the server)?

参考




  1. Is page output cache stored in ASP.NET cache object?
  2. Things Caches Do - Ryan Tomayko - 2ndscale.com/


推荐答案

实际上用于客户端作为服务器端缓存。当您将该指令的位置设置为 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

这篇关于ASP.Net Web窗体是否有任何Http缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 22:49