Allows insertion of response substitution blocks into the response, which allows dynamic generation of specified response regions for output cached responses.
You can use the HttpResponse.WriteSubstitution(HttpResponseSubstitutionCallback) method for post-cache substitution in your output-cached pages. By passing an System.Web.HttpContext object to a callback method with a prescribed System.Web.HttpResponseSubstitutionCallback signature, you can replace output cached content at any given location in the page cache. To initiate the replacement, call the HttpResponse.WriteSubstitution(HttpResponseSubstitutionCallback) method, passing it the callback method, which must be thread safe and can be either of the following:
A static method on the container page or user control.
A static or instance method on another arbitrary object.
On the first request to the page, the HttpResponse.WriteSubstitution(HttpResponseSubstitutionCallback) calls the System.Web.HttpResponseSubstitutionCallback delegate to produce the output. Then, it adds a substitution buffer to the response, which retains the delegate to call on future requests. Finally, it degrades client-side cacheability from public to server-only, ensuring future requests to the page re-invoke the delegate by not caching on the client.
Post-cache substitution is not supported for a cached user control where output caching is applied at the user control level. This is also known as fragment caching. For more information, see Caching Portions of an ASP.NET Page.