Mon
Jun 25
2007

HttpContext.Cache vs. HttpContext.Items

HttpContext.Cache is simply a pointer the HttpRuntime.Cache also known as the application cache. This can be verified by opening System.Web with Reflector. The MSDN documentation for this member is misleading: “Gets the Cache object for the current HTTP request”. Information stored here is global to the application domain, not a specific request.

To store per-request information use HttpContext.Items.

© 2009 Brian Low. All rights reserved.