Share article ASP.NET Interview Questions: - How will you explain Post Cache substitution?: This is one of the asked ASP.Net Interview Questions during the Int ...
This is one of the asked ASP.Net Interview Questions during the Interview by the Interviewer.
Post cache substitution is used when we want to cache the whole page but also need some dynamic region inside that cached page. Some examples like QuoteoftheDay, RandomPhotos, and AdRotator etc. are examples where we can implement Post Cache Substitution.
Post-cache substitution can be achieved by two means:
Figure: - “Writesubstitution” in action
You can see we have a static function here “GetDateToString()”. We pass the response substitution callback to the “WriteSubstitution” method. So now, when ASP.NET page framework retrieves the cached page, it automatically triggers your callback method to get the dynamic content. It then inserts your content into the cached HTML of the page. Even if your page has not been cached yet (for example, it's being rendered for the first time), ASP.NET still calls your callback in the same way to get the dynamic content. So you create a method that generates some dynamic content, and by doing so you guarantee that your method is always called, and it’s content is never cached.
Ok the above example was by using “WriteSubstitution” now lets try to see how we can do by using “<asp:Substitution>” control. You can get the “<asp:Substitution>” control from the editor toolbox.
Figure: - Substitution Control
Figure: - Substitution in Action
Below is a sample code that shows how substitution control works. We have ASPX code at the right hand side and class code at the behind code at the left hand side. We need to provide the method name in the “methodname” attribute of the substitution control.
View following video on Web.config transformation in ASP .Net: -
Learn more on ASP.NET interview questions
Regards,
From more on author’s blog related to ASP.NET interview questions click and visit.
.Net interview questions: - Explain why it is not preferred to use finalize for clean up?
.Net interview questions: - Show the five levels in CMMI?
C# interview questions and answers: – Explain the use of Icomparable in c#?
C# interview questions: - How can we check which rows have changed since dataset was loaded?
C# interview questions and answers: - Can you write a simple c# code to display Fibonacci series?
.NET interview questions and answers: - What is difference betweenIcomparable VS Icomparer ?
C# and .NET interview question: -What is short circuiting in C#?
C# and .NET interview question: - What are symmetric and asymmetric algorithms?
Important c# and .NET interview question on object pooling and Gridview events?
.NETinterview questions and answers: – Will
the finally run in this code?
How to prepare for c# and .NETinterviews?
C# and .NET Interview questions: - What is Thread.Join () in threading?
.NET Interview questions and answers: -What is serialization and deserialization in .NET?
C# and .NET interview question: - What is hashing?
c# and .NET interview question:- what connects dataset and data source ?
.NET interview questions and answers: - What is TPL?
.NET Interview questions and answers: -What are different access modifiers?
MVC ( Model view controller) interview questions and answers
ASP.NET Application and Page Life Cycle
6 important use of Partial/Mock testing
6 important uses of Delegates and Events
7 Simple Steps to Run Your First Azure Blob Program
8 Steps to Create Workflows using SharePoint Designer
C# Code Reviews using StyleCop – Detailed Article
Four real world uses of Partial classes and Partial methods
SharePoint Quick Start FAQ Part 1
SharePoint Quick Start FAQ Part 6 – Workflows, Workflows and Workflows
MVC Interview questions and answers Article
(Model view controller)MVC Interview questions and answers
MVC interview questions with answers video: – What is Web API how to implement the same?
WCF Interview questions videos
C# Interview Questions & Answers Article
6 important use of Partial/Mock testing
6 important uses of Delegates and Events
7 Simple Steps to Run Your First Azure Blob Program
8 Steps to Create Workflows using SharePoint Designer
C# Code Reviews using StyleCop – Detailed Article
Four real world uses of Partial classes and Partial methods
SharePoint Quick Start FAQ Part 1
SharePoint Quick Start FAQ Part 6 – Workflows, Workflows and Workflows
C# (Csharp) interview questions and answers: – What are indexers in .NET?
C# OOP interview questions and answers: - I do not want to implement all the interface methods?
C# design pattern (UNIT of Work Design Pattern)
C# design pattern interview questions – What
is Dependency injection ?
C# interview questions and answers: - What is the difference between
“==” and .Equals()?
How questions are asked in c# interviews?
C# design pattern interview question: - DI vs IOC
8 important C# Interview questions on IL code, JIT, CLR, CTS, CLS and CAS
What is the difference between Reflection and Dynamic in
C#?
C# and .NET interview question: – When should we use Structure as compared to classes?
C# REST interview questions with answers asked in Polaris Hydrebad
Algorithm interview questions and answers: – Can you write code for bubble sort algorithm?
Algorithm interview questions and answers: – What is inserted sort algorithm?
SQL Server Interview Questions & Answers Article
SQL Server interview questions and answers: - What is HID data type in SQL Server ?
.NET INTERVIEW QUESTIONS & ANSWERS ARTICLE
.NET interview questions and answers: - How to reverse a string in .NET ( DotNet)?
.NET interview questions and answers: - What is the use of Click Once?
.NET interview questions and answers: - Will the below codes create new instances?
C# and .NET interview questions with answers – What is Nuget?
Dependency injection (DI) VS Inversion of Control (IOC)
.NET interview questions with answers: - What is the difference between Reflection and Dynamic?
Five Great .NET Framework 4.5 Features
WPF INTERVIEW QUESTIONS & ANSWERS ARTICLE
6 important
WPF and Silverlight Multi-threading interview questions with answers
C# WPF interview questions::- What are dependency properties ?
WCF INTERVIEW QUESTIONS & ANSWERS ARTICLE