Output Caching Demo

This page is cached for a duration of 5 seconds. When this page was last cached the date/time was 11/22/2017 1:56:51 PM. Refresh repeatedly and you'll see that this time remains constant until the cache is expired, then it is updated to the current time.

The reason this time stays constant is because the HTML generated by this ASP.NET Web page is cached using Output Caching. To enable Output Caching, simply add the following declaration to the top of your ASP.NET Web page:

<%@OutputCache Duration="durationInSeconds" VaryByParam="varyBy" %>

[Return to the article]