Wondering how ASP.NET page caching relates to IIS6 kernel-mode caching?
- With output caching enabled for a Web Form, the page will be served directly from the Windows Server 2003 kernel if VaryByParam=“None“ and no other Vary settings are specified. The framework will not be called in any way - Application_BeginRequest will not fire.
- If VaryByParam, VaryByControl, or VaryByCustom is used, then Application_BeginRequest and Application_EndRequest will fire and the kernel cache will not be used.
- According to informal tests using ACT, the kernel cache doubles the performance of a cache hit.
Refer to http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconoutputcache.asp
How are POSTs handled? These rules are independent of kernel caching.
- The request params (whether query string or POST params) are not part of the cache key. That is, unless you use VaryByParam or VaryByControl, the same cache entry will be returned no matter what the query params are.
- The cache key is the request path and the http method. That is, a postback button on the page will cause a cache miss on the first click, but not on subsequent clicks.
It is typically desirable to suppress caching on a POST. To do this, use this code in Application_BeginRequest or in Page_Load - Postbacks will be treated as cache misses.