Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
What is Post Cache substitution
What is Post Cache substitution?
✍: Guest
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:
ã Call the new Response.WriteSubstitution method, passing it a reference to the desired
substitution method callback.
ã Add a <asp:Substitution> control to the page at the desired location, and set its
methodName attribute to the name of the callback method.
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 hasn't 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 “
Below is a sample code which 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.
2007-10-23, 5748👍, 0💬
Popular Posts:
How Many Tags Are Defined in HTML 4.01? There are 77 tags defined in HTML 4.01: a abbr acronym addre...
Write out a function that prints out all the permutations of a string. For example, abc would give y...
What are the five levels in CMMI? There are five levels of the CMM. According to the SEI, Level 1 – ...
What’ is the sequence in which ASP.NET events are processed ? Following is the sequence in which the...
How To Specify Two Background Images on a Page? - CSS Tutorials - Page Layout and Background Image D...