Is there any Http Caching for ASP.Net Web Forms?

ぐ巨炮叔叔 提交于 2019-12-07 12:12:51

问题


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.

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)?

REFERENCES

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

回答1:


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.

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

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


来源:https://stackoverflow.com/questions/38965684/is-there-any-http-caching-for-asp-net-web-forms

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!