Output Caching Demo

This page is cached for a duration of 5 seconds. When this page was last cached the date/time was 8/2/2021 8:26:30 AM. 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]