編輯

共用方式為


HttpServerUtilityWrapper.Execute Method

Definition

Executes the handler for a specified resource in the context of the current request and returns execution to the process that invoked it.

Overloads

Execute(String)

Executes the handler for the specified virtual path in the context of the current process.

Execute(String, Boolean)

Executes the handler for the specified virtual path in the context of the current process and specifies whether to clear the QueryString and Form collections.

Execute(String, TextWriter)

Executes the handler for the specified virtual path in the context of the current process, using a TextWriter instance to capture output from the executed handler.

Execute(String, TextWriter, Boolean)

Executes the handler for the specified virtual path in the context of the current request, using a TextWriter instance to capture output from the page and a value that indicates whether to clear the QueryString and Form collections.

Execute(IHttpHandler, TextWriter, Boolean)

Executes the specified handler in the context of the current process, using a TextWriter instance to capture output from the executed handler and a value that specifies whether to clear the QueryString and Form collections.

Execute(String)

Executes the handler for the specified virtual path in the context of the current process.

public:
 override void Execute(System::String ^ path);
public override void Execute (string path);
override this.Execute : string -> unit
Public Overrides Sub Execute (path As String)

Parameters

path
String

The URL of the handler to execute.

Exceptions

The current HttpContext object is null.

-or-

An error occurred when the handler specified by path was executed.

path is null.

-or-

path is not a virtual path.

Applies to

Execute(String, Boolean)

Executes the handler for the specified virtual path in the context of the current process and specifies whether to clear the QueryString and Form collections.

public:
 override void Execute(System::String ^ path, bool preserveForm);
public override void Execute (string path, bool preserveForm);
override this.Execute : string * bool -> unit
Public Overrides Sub Execute (path As String, preserveForm As Boolean)

Parameters

path
String

The URL of the handler to execute.

preserveForm
Boolean

true to preserve the QueryString and Form collections; false to clear the QueryString and Form collections.

Exceptions

The current HttpContext object is null.

-or-

An error occurred when the handler specified by path was executed.

path is null.

-or-

path is not a virtual path.

Applies to

Execute(String, TextWriter)

Executes the handler for the specified virtual path in the context of the current process, using a TextWriter instance to capture output from the executed handler.

public:
 override void Execute(System::String ^ path, System::IO::TextWriter ^ writer);
public override void Execute (string path, System.IO.TextWriter writer);
override this.Execute : string * System.IO.TextWriter -> unit
Public Overrides Sub Execute (path As String, writer As TextWriter)

Parameters

path
String

The URL of the handler to execute.

writer
TextWriter

An object to capture the output.

Exceptions

The current HttpContext is null.

-or-

An error occurred when the handler specified by path was executed.

path is null.

-or-

path is not a virtual path.

Remarks

The writer parameter is passed by reference to the Execute method. To retrieve the output from the handler after the method completes, you use the properties and methods of the writer object. For an example, see Execute.

Applies to

Execute(String, TextWriter, Boolean)

Executes the handler for the specified virtual path in the context of the current request, using a TextWriter instance to capture output from the page and a value that indicates whether to clear the QueryString and Form collections.

public:
 override void Execute(System::String ^ path, System::IO::TextWriter ^ writer, bool preserveForm);
public override void Execute (string path, System.IO.TextWriter writer, bool preserveForm);
override this.Execute : string * System.IO.TextWriter * bool -> unit
Public Overrides Sub Execute (path As String, writer As TextWriter, preserveForm As Boolean)

Parameters

path
String

The URL of the handler to execute.

writer
TextWriter

The object to capture the output.

preserveForm
Boolean

true to preserve the QueryString and Form collections; false to clear the QueryString and Form collections.

Exceptions

The current HttpContext instance is null.

-or-

path ends with a period (.).

-or-

An error occurred when the handler specified by path was executed.

path is null.

path is not a virtual path.

Applies to

Execute(IHttpHandler, TextWriter, Boolean)

Executes the specified handler in the context of the current process, using a TextWriter instance to capture output from the executed handler and a value that specifies whether to clear the QueryString and Form collections.

public:
 override void Execute(System::Web::IHttpHandler ^ handler, System::IO::TextWriter ^ writer, bool preserveForm);
public override void Execute (System.Web.IHttpHandler handler, System.IO.TextWriter writer, bool preserveForm);
override this.Execute : System.Web.IHttpHandler * System.IO.TextWriter * bool -> unit
Public Overrides Sub Execute (handler As IHttpHandler, writer As TextWriter, preserveForm As Boolean)

Parameters

handler
IHttpHandler

The HTTP handler that implements the interface to transfer the current request to.

writer
TextWriter

The object to capture the output.

preserveForm
Boolean

true to preserve the QueryString and Form collections; false to clear the QueryString and Form collections.

Exceptions

An error occurred when the handler specified by handler was executed.

The handler parameter is null.

Applies to