Geeks With Blogs
Eron Wright - All Killer No Filler blog

Wondering how ASP.NET page caching relates to IIS6 kernel-mode caching? 

  1. 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. 
  2. If VaryByParam, VaryByControl, or VaryByCustom is used, then Application_BeginRequest and Application_EndRequest will fire and the kernel cache will not be used.
  3. 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.

  1. 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.
  2. 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.

if(HttpContext.Current.Request.HttpMethod=="POST") this.Response.Cache.SetNoServerCaching();

Posted on Friday, October 24, 2003 12:04 PM Technology | Back to top


Comments on this post: ASP.NET Page Caching and IIS6 Kernel-Mode Caching

# re: ASP.NET Page Caching and IIS6 Kernel-Mode Caching
Requesting Gravatar...
That sounds good!

Thank's
Left by Simon on Aug 09, 2007 7:00 AM

# re: ASP.NET Page Caching and IIS6 Kernel-Mode Caching
Requesting Gravatar...
There is a nice blog on Kernel Mode Response Cache with IIS 6.
http://blogs.msdn.com/david.wang/archive/2005/07/07/HOWTO_Use_Kernel_Response_Cache_with_IIS_6.aspx
Left by Vijay KArla on Feb 09, 2009 6:17 AM

Your comment:
 (will show your gravatar)
 


Copyright © Eron Wright | Powered by: GeeksWithBlogs.net | Join free