- Top 10 ASP.NET Interview Questions and Answers for ASP.NET Web Developers
- ASP.NET Interview Questions – Part 1 (Controls, State Management etc.)
- ASP.NET Interview Questions – Part 2 (Controls, Globalization & Localization etc.)
- ASP.NET Interview Questions – Part 3 (Caching & Security etc.)
- ASP.NET Interview Questions – Part 4 (Security)
- ASP.NET Interview Questions – Part 5 (ASP.NET AJAX)
- ASP.NET Interview Questions – Part 6 (ASP.NET Web API)
For a comprehensive list of ASP.NET MVC Interview Questions, follow here.
ASP.NET Interview Questions List – Part 3
- What is Caching and what are the benefits of using it?
- Cache Management in ASP.NET?
- Page Output Cache Vs Partial Page Cache Vs Application Data Cache in ASP.NET?
- How to use Page Output Cache in ASP.NET?
- How to use Page Fragment or Partial Page Cache in ASP.NET?
- How to use Data Cache in ASP.NET?
- Authentication Vs Authorization?
- What are the available Authentication modes in ASP.NET?
- What is the difference between Windows Authentication and Forms Authentication in ASP.NET?
- What is Protected Configuration in ASP.NET?
Performance has always been a concern for web based applications. So, Caching is a mechanism that improve performance for an application by storing data in memory for fast access. When the application will access data from Cache (i.e. in-memory) instead of fetching it from original data store (may be a database), it will definitely improve performance.But Caching benefits are not limited to performance only, it also improve application Scalability as well as Availability.
- Load on server is reduced when data is fetched from Cache instead of original source, thus improving scalability of an application.
- Caching normally keep serving application data even if the original source is temporarily down, thus improving availability of an application.
ASP.NET supports three types of Caching:
- Page Output Caching
- Partial Page Caching
- Data Caching
Page Output Cache
In case of Page Output Cache, the output of a complete web page is stored in a cache. So, when that web page is accessed again, it will be loaded from cache instead of fetching page data again from data source.
Partial Page Cache
For Partial Page Cache (also known as Page Fragment Cache), a part or fragment of a web page is stored in Cache as opposed to complete page caching for Page Output Cache. For example, caching a user control on a web page that displays product categories using Page Fragment Cache.
In some scenarios, we may store frequently used objects into cache using ASP.NET Cache API. So, later on, that object will be loaded from cache instead of instantiating object again and fetching data from original source for it.
Now, when we will access the page, it will verify that either it exists in Cache? if Yes, then verify that is it expired? If not then fetch it from Cache and render otherwise create a new instance of the page and put it back to Cache.
<%@ OutputCache Duration=”50″ VaryByParam=”None” VaryByControl=”ControlName” %>
In this case, Cache is dependent on the value of Control specified in VaryByControl parameter. For example, content on a page are dependent on the selected values of a dropdownlist, so, VaryByControl will have the dropdownlist control name as value.
Back to top
To retrieve it back:
Other Related Articles:
Top 10 Interview Questions and Answers Series:
- Top 10 ASP.NET AJAX Interview Questions
- Top 10 WCF Interview Questions
- Comprehensive Series of WCF Interview Questions
- Top 10 HTML5 Interview Questions
- Top 10 ASP.NET Interview Questions
- Comprehensive Series of ASP.NET Interview Questions
- Top 10 ASP.NET MVC Interview Questions
- Top 10 ASP.NET Web API Interview Questions