Home | Articles|Namespace|Interview Questions|Tools|Jobs|Projects|Community
Asp.net Tutorials

»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 caching

This 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

Have a Question and dont know the answer post it below and get answers in minutes

Due to spam this feature is disabled
To get answers fast , make sure you enter a detailed subject for example: "DataGrid issues need answer" not "DataGrid"

Subject:

Catjegory Name:

Message:



© 2008 dotnetwatch.com -- Privacy policy