Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
TransferRequest Method (String, Boolean, String, NameValueCollection)

HttpServerUtility::TransferRequest Method (String, Boolean, String, NameValueCollection)

Performs an asynchronous execution of the specified URL using the specified HTTP method and headers.

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

public:
void TransferRequest(
	String^ path, 
	bool preserveForm, 
	String^ method, 
	NameValueCollection^ headers
)

Parameters

path
Type: System::String

The URL path of the new page on the server to execute.

preserveForm
Type: System::Boolean

true to preserve the Form collection; false to clear the Form collection.

method
Type: System::String

The HTTP method to use in the execution of the new request.

headers
Type: System.Collections.Specialized::NameValueCollection

A NameValueCollection of request headers for the new request.

ExceptionCondition
PlatformNotSupportedException

The request requires IIS 7.0 running in integrated mode.

HttpException

The server is not available to handle the request.

ArgumentNullException

The path parameter is nullptr.

ArgumentException

The path parameter is invalid.

This method is used when running with the integrated pipeline mode in IIS 7.0 to allow request processing to be transferred from one resource type to another while executing the target request with the correct request context. For example, you can use the TransferRequest method to transfer a request for an ASPX page to a request for an XML page.

The TransferRequest method performs an asynchronous child execution of the specified URL with the following conditions:

  • If the path parameter specifies a query string, it will be used as the new query string. If no query string is included, the query string of the request will be re-used.

  • If the method parameter is specified, it will be used. If it is nullptr, the HTTP method of the original request will be used.

  • If the preserveForm parameter is true, the current entity body of the request will be available to the target request. This allows form posts and uploads to be transferred.

  • If the user identity is currently set on the original request, the identity will be transferred to the new request. This allows authenticated requests to re-use the result of the authentication for the new request. If you do not want the user to be transferred, set the user to nullptr on the original request before transferring.

  • If the headers parameter is specified, the new request will execute with the specified headers. This can be used to modify the request headers and cookies for the new request, or add a special header that specifies where the original request was received.

    This method calls the TransferRequest(String, Boolean, String, NameValueCollection, Boolean) method overload with the preserveUser parameter set to true.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5 SP1, 3.0 SP1, 2.0 SP1
Show:
© 2015 Microsoft