3

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/
Community
  • 1
  • 1
LCJ
  • 22,196
  • 67
  • 260
  • 418
  • More reference: [HOW-TO: HTTP CACHING FOR RESTFUL & HYPERMEDIA APIS](http://www.apiacademy.co/how-to-http-caching-for-restful-hypermedia-apis/) – LCJ Aug 18 '16 at 21:08
  • And http://stackoverflow.com/questions/945898/cache-control-headers-in-asp-net – LCJ Aug 26 '16 at 12:44

1 Answers1

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
Niels V
  • 1,005
  • 8
  • 11
  • Please read [max-age](https://tools.ietf.org/html/rfc7234#section-5.2.2.8). I guess, all the approaches you mentioned tells the client to consider data as stale after a time period. It doesn't validate whether the data actually changed by sending a request to server, using a mechanism like `ETag` . – LCJ Aug 18 '16 at 21:06
  • No, it doesn't do ETag validation out of the box. IIS does it for static content, but ASP.NET webforms not. But please refrase your question what you actually are looking for. – Niels V Aug 21 '16 at 17:49