»Dotnet Ads
»Message Boards
Message Boards
Dotnet Books
»Member Details
Register
Login
LogOut
Submit Code
Submit Jobs
Submit Projects
»Competition
Community
Winners
Prizes
Write For Us
Members
»Other Resources
Links
Dotnet Resources
|
Asp.net Page output cachingThis small article shows how to use page output caching to make your asp.net pages load fast.
Most of the sites today are database driven sites. And operations like accessing database information can be one of the most expensive operations of an ASP page's life cycle. If a database is fairly static for a certain period of time then we can use page output caching.
Page output caching caches the HTML output of dynamic requests to ASP.NET Web pages. The way ASP.NET implements this is through an Output Cache engine. Each time an incoming ASP.NET page request comes in, this engine checks to see if the page being requested has a cached output entry. If it does, this cached HTML is sent as a response; otherwise, the page is dynamically rendered, it's output is stored in the Output Cache engine.
.NET Framework has a lot of classes that does just that.
<%@ OutputCache Duration="120" VaryByParam="none" %>
|
include the above code at the top of a aspx page.
The Duration and VaryByParam attributes are both required and an error is returned if either is omitted. If you have no need to use the functionality offered by VaryByParam, set its value to None.
The duration is in second in the above i gave a value of 2 mintues
|