ASP.NET

Caching Output

This tutorial covers ASP.NET's support for caching output. In Tutorial 14, we saw what an impact data caching could make on your application. By avoiding round-trips to the database, you can make parts of your Web site run much faster than they otherwise would. In addition to data caching, ASP.NET supports output caching.

After completing this tutorial, you will be able to

  • Cache content
  • Improve the performance of Web applications by using output caching
  • Manage the cached content through the OutputCache directive
  • Manage the cached content through the HttpCachePolicy class

After spending a bit of time watching the whole page-rendering process, you now know it can be pretty involved. A lot happens between the time a page loads and the final closing tag is sent to the browser. For example, the page may require database access. It may have a number of controls declared on it. Furthermore, perhaps some of those controls are the more complex controls like the DataList or the GridView whose rendering process is expensive. All these things usually take time to process.

Just as you can bypass whole round-trips to a database by caching data in memory, you may configure ASP.NET to bypass the whole page-rendering process and send back content that's already been rendered once. This is called output caching.