Enable output caching for all GET requests

  • Thread starter Thread starter Joern Schou-Rode
  • Start date Start date
J

Joern Schou-Rode

I would like to enable output caching for every GET request in my ASP.NET
MVC application. From searching the net, I am not able to find any central
way to enable such caching. All articles seems to be focusing on how to
enable caching for specific URL's, possible varying by HTTP headers og
query string parameters.

I do not need any varying, except from the URL, and I want caching to be
used for any GET request. IMHO such setup should only concern the IIS, but
the articles I find all seem to be specific to ASP.NET apps.

Am I missing something really simple?

Thanks in advance.
 
IIS does not cache responses of dynamic applications like ASP.Net
since by-definition, their output can be "dynamic" and hence not worth
caching. IIS is never told by dynamic applications the necessary
details to cache properly -- hence the safest, most correct action is
to not cache. On its own, IIS only caches static pages since by
definition, they are relatively "static" over time and hence worth
caching.

However, ASP.Net has specialized knowledge, provided by the
programmer, on what bits of its dynamic pages are "relatively static"
and thus worth directing IIS to cache. Therefore, in an ASP.Net
application, you need to concentrate on ASP.Net for caching support.

Now, it is always possible that your application relies on a caching
semantic which is not expected by ASP.Net and thus not cooperate with
ASP.Net's generic caching support. In those cases, you will either
have to forego caching, or figure out a design for your ASP.Net
application that is compliant with how it works. Or write your own
proprietary software/cache that works the way you want.


//David
http://w3-4u.blogspot.com
http://blogs.msdn.com/David.Wang
//
 
Back
Top