How Do I?

[How Do I:] Control the Caching of an ASP.NET Page Based Upon Custom Information

By Chris Pels|12 minutes|
In this video Chris Pels shows how to control the criteria for caching an ASP.NET page based upon custom information. A sample page is created and then the OutputCache directive is used with the VaryByCustom attribute which contains a custom value. Next, the GetVaryCustomByString() method is overridden in the global.asax module which provides the handling of the custom attribute. In that method a string is returned that uniquely identifies the cached version of the page. Finally, there is a discussion about how caching using a custom value can be used in several ways for a web site.

DOWNLOADS: Code (C#)|Code (VB)|MP3|MP4|WMV

This article was originally created on February 19, 2009

Author Information

Chris Pels

Chris Pels – Chris has been instrumental in the architecture, development, and implementation of a wide variety of business systems and databases as a technology consultant since 1986. He has extensive experience in business analysis, technical specifications, database design, several programming languages including C# and VB.NET, and statistical analysis. He holds a Ph.D. from The University of Michigan and has been a speaker at Microsoft TechEd, Microsoft DevDays, VSLive, numerous events in New England