The page output cache stores the contents of a processed ASP.NET page in memory. This allows ASP.NET to send a page response to a client without going through the page processing lifecycle again. Page output caching is especially useful for pages that do not change often but require significant processing to create. For example, if you are creating a high-traffic Web page to display data that is not frequently updated, page output caching can dramatically increase the performance of that page. Page caching can be configured individually for each page, or you can create cache profiles in the Web.config file, which allow you to define caching settings once and then use those settings with multiple pages.
Page output caching provides two models for page caching: full page caching and partial page caching. Full page caching allows the entire contents of a page to be persisted to memory and used to fulfill client requests. Partial page caching allows parts of a page to be cached and other parts to be dynamic. For more information see Caching ASP.NET Pages.
Partial page caching can work in two ways: control caching and post-cache substitution. Control caching, also sometimes referred to as fragment caching, allows you to cache parts of the page output by including the information in a user control and then marking the user control as cacheable. This allows specific content within a page to be cached, while the overall page is not cached and therefore recreated each time. For example, if you create a page that displays largely dynamic content, such as stock information, but has sections that are static, such as weekly summaries, you can place the static sections in user controls and allow them to be cached.
Post-cache substitution is the opposite. The page as a whole is cached, but fragments within the page are dynamic. For example, if you create a page that is static for set periods of time, you can set the entire page to be cached. If you added a Label control to the page that displayed the user's name, the Label would stay the same for each page refresh and each user, showing the name of the user who requested that page before it was cached. However, with post-cache substitution, you can configure the page to be cached, but mark individual sections of the page as not cacheable. In this case, you could add your Label controls to a non-cacheable section and they would be dynamically created for each user and page request. For more information, see Caching Portions of an ASP.NET Page.
Caching Pages Based on Request Parameters
In addition to caching a single version of a page, ASP.NET page output caching provides features to create multiple versions of the page that vary by different request parameters. For more information, see Caching Multiple Versions of a Page.