Types of caching in ASP.NET

What are the types of Caching in ASP.NET?

Caching in ASP.NET can be of the following types.

1. Page Output Caching
2. Page Fragment Caching
3. Data Caching

Explain in brief each kind of caching in ASP.NET.

Page Output Caching

- This type of caching is implemented by placing OutputCache directive at the top of the .aspx page at design time.

Example:
<%@OutputCache Duration= "30" VaryByParam= "DepartmentId"%>

- The duration parameter specifies for how long the page would be in cache and the VaryByParam parameter is used to cache different version of the page.

- The VaryByParam parameter is useful when we require caching a page based on certain criteria.

Page Fragment Caching
- This technique is used to store part of a Web form response in memory by caching a user control.

Data Caching
- Data Caching is implemented by using Cache object to store and quick retrieval of application data.

- Cache object is just like application object which can be access anywhere in the application.

- The lifetime of the cache is equivalent to the lifetime of the application. .
Ways of handling exceptions in ASP.NET
ASP.NET - Ways of handling exceptions in ASP.NET - Exceptions or errors are unusual occurrences that happen within the logic of an application. ..
Try/catch block method of exception handling
ASP.NET - Explain Try/catch block method of exception handling - There are three ways to handle exceptions in ASP.NET...
Error Events method of exception handling - ASP.NET
ASP.NET - Error Events method of exception handling - You can enclose code in Try/Catch/Finally block.......
Post your comment