Output Caching Demo

This page is cached for a duration of 5 seconds. When this page was last cached the date/time was 8/18/2018 10:22:17 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]