Click here to hide categories Click here to show left categories

User: Home          welcome : Guest          Log In / Register here     




ASP.NET caching interview questions: - What are different types of caching using cache object of ASP.NET? How can you cache different version of same page using ASP.NET cache object?

Following are various ASP.NET caching interview questions asked by the interviewer.

You can use two types of output caching to cache information that is to be transmitted to and displayed in a Web browser:

  • Page Output Caching 

Page output caching adds the response of page to cache object. Later when page is requested page is displayed from cache rather than creating the page object and displaying it. Page output caching is good if the site is fairly static.

  • Page  Fragment Caching

If parts of the page are changing, you can wrap the static sections as user controls and cache the user controls using page fragment caching.

Caching different version of same page: -

Output cache functionality is achieved by using “OutputCache” attribute on ASP.NET page header. Below is the syntax

<%@ OutputCache Duration="20" Location="Server" VaryByParam="state"
VaryByCustom="minorversion" VaryByHeader="Accept-Language"%>

  • VaryByParam: - Caches different version depending on input parameters send through HTTP POST/GET.
  • VaryByHeader: - Caches different version depending on the contents of the page header.
  • VaryByCustom:- Lets you customize the way the cache handles page variations by declaring the attribute and overriding the GetVaryByCustomString handler.
  • VaryByControl:- Caches different versions of a user control based on the value of properties of ASP objects in the control.




Helpful Website Url
http://questpond.com/
Share this article   |    Print    |    Article read by 177 times
Author:
Shivprasad koirala Koirala
I am a Microsoft MVP for ASP/ASP.NET and currently a CEO of a small E-learning company in India. We are very much active in making training videos , writing books and corporate trainings. Do visit my site http://www.questpond.com for .NET, C# , design pattern , WCF , Silverlight , LINQ , ASP.NET , ADO.NET , Sharepoint , UML , SQL Server training and Interview questions and answers
Related Articles:
Related Interview Questions: