Caching is process of saving html and data in browser cache. Some data are difficult to obatin it assumes lot of resouceof the server. The best way to store it in cache. So we can retrive from cache instead doing round trip to the server.There are also some portion of the site does not change frequently so caching is a good idea to store this portion ofwebsite in cahce rather then loadind it from server.ASP.NET also provide caching features.ASP.NET Caching API provides great features for caching.ASP.NET provide three types of caching.1) Page Output Caching2) Page Fragment Caching3) Data Caching
1) Page Output Caching:
In ASP.NET you can do page output caching with output directive….Here is the code for output cachingThis means that page will cache for 120 second and during that time page will not change with get or post parameters.After 120 second page cache will be flush and then page content can be change by get or post parameters.
2) Page Fragment Caching:
We all know that it is impratical to cache whole page of website. So it is better cache a portion of a website thenwhole page. ASP.NET caching API also provide that feature.From Following code asp.net can cache categoryid parameter of get and post method.You can also cache whole control in asp.net which can be used as portion of parameter.