Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

HttpResponse.WriteSubstitution Method

Note: This method is new in the .NET Framework version 2.0.

Allows insertion of response substitution blocks into the response, which allows dynamic generation of specified response regions for output cached responses.

Namespace: System.Web
Assembly: System.Web (in system.web.dll)

public void WriteSubstitution (
	HttpResponseSubstitutionCallback callback
)
public void WriteSubstitution (
	HttpResponseSubstitutionCallback callback
)
public function WriteSubstitution (
	callback : HttpResponseSubstitutionCallback
)

Parameters

callback

The method, user control, or object to substitute.

You can use the WriteSubstitution method for post-cache substitution in your output-cached pages. By passing an HttpContext object to a callback method with a prescribed HttpResponseSubstitutionCallback signature, you can replace output cached content at any given location in the page cache. To initiate the replacement, call the WriteSubstitution method, passing it the callback method, which must be thread safe and can be either of the following:

  • A static method on the containing page or user control.

  • A static or instance method on another arbitrary object.

On the first request to the page, the WriteSubstitution calls the 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.

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.