Use Asp.Net Output Caching You can cache entire pages or page fragments (usercontrols).
ASP.NET allows you to cache some or all of the response generated by
an ASP.NET page, referred to in ASP.NET as output caching. You can
cache the page at the browser making the request, at the Web server
responding to the request, and at any other cache-capable devices,
such as proxy servers, that are in the request or response stream.
Caching provides a powerful way for you to increase the performance of
your Web applications. Caching allows subsequent requests for a page
to be satisfied from the cache so the code that initially creates the
page does not have to be run again. Caching your site's most
frequently accessed pages can substantially increase your Web server's
throughput, commonly measured in requests per second.
Thisi is a small example just to explain how it works:
in order to cache a page's output, use the @OutputCache directive at the top of the page:
<%@ OutputCache Duration=5 VaryByParam="None" %>
- Duration - The time in seconds of how long the output should be cached. After the specified duration has elapsed, the cached output will be removed and page content generated for the next request. That output will again be cached for 5 seconds and the process repeats.
- VaryByParam - This attribute is compulsory and specifies the querystring parameters to vary the cache. To specify multiple parameters, use semicolon or * for all parameters passed through the querystring