Post cache substitution, DOT NET Programming

What is Post Cache substitution?

The Post cache substitution is used when we want to cache the complete page but also require some of the dynamic region inside that cached page. Some examples such as RandomPhotos, QuoteoftheDay, and AdRotator etc.  Where we can implement the Post Cache Substitution.

Post-cache substitution can be achieved by 2 means:

1) Call the new Response.WriteSubstitution process, passing it a reference to the desired substitution method callback.

2) Add a control to the page from  the desired location, and fixed  its methodName attribute to the name of the callback method.

816_post cache substitution.png

Figure: - "Writesubstitution" in action

We have "GetDateToString()" a static function  . We pass the response substitution callback to the "WriteSubstitution" process. So now when ASP.NET page framework retrieves the cached page, it automatically triggers your callback process to get the dynamic content. Now it inserts your content into the cached HTML of the page. Even if your page hasn't been cached yet (for example, it's being rendered for the first time), ASP.NET still calls your callback into the same way to get the dynamic content. So you create a process which generates some dynamic content, and by doing so you assure  that your process is always called, and it's content is never cached.

The example above was by using "WriteSubstitution" now lets try to see how we can do by using "" control. You can get the "" control from the editor toolbox.

75_post cache substitution1.png

Figure: - Substitution Control

1735_post cache substitution2.png

Figure: - Substitution in Action

Posted Date: 9/21/2012 9:09:11 AM | Location : United States







Related Discussions:- Post cache substitution, Assignment Help, Ask Question on Post cache substitution, Get Answer, Expert's Help, Post cache substitution Discussions

Write discussion on Post cache substitution
Your posts are moderated
Related Questions
Find out the Factorial - C# Program I've been trying so many codes for this but those codes didn't work well. Please write the code for find out the factorial of an integer nu

Audio Expert in C# Required - Generate Audio Engine, Exciting Project! Project Description: We need an EXPERT CODER to help us create an 'audio engine' in C#. We need to b

Needed Expert Ruby in Rail Deveoloper - urgent Project Description: I require an expert Ruby on Rail developer. Need someone who has depth in knowledge of Ruby on Rail. Wi

What are the problems that can occur if you do not implement locking properly in SQL SERVER? The problems that occur if you do not implement locking properly in SQL SERVER is a

What is the difference among synchronous postback and asynchronous postback? The difference between synchronous and asynchronous postback is as follows: Asynchronous postbac

Explain the DataAdapter.Update() and DataSetAcceptChanges() methods. The DataAdapter.Update() method calls any of the DML statements, like UPDATE, INSERT, or DELETE statements,

How do I force the Dispose method to be called automatically, as clients can forget to call Dispose method? To Call the Dispose method in the Finalize method and in the Dispose

How do we access view state value of the page in the next page? The View state is page specific; it contains information about controls embedded at the particular page. ASP.NET

What is ReaderWriter Locks? You may want to lock the resource only whenever data is being written and permit multiple clients to parallel read data when data is not being updat

What is the difference between "Web farms" and "Web garden"? The "Web farms" are used to have some redundancy to reduce the failures. It consists of two or more web server of t