HttpServerUtility.Execute Method (String, Boolean)

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

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

public void Execute (
	string path,
	bool preserveForm
)
public void Execute (
	String path, 
	boolean preserveForm
)
public function Execute (
	path : String, 
	preserveForm : boolean
)
Not applicable.

Parameters

path

The URL path to execute.

preserveForm

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

Exception typeCondition

HttpException

The current HttpContext is a null reference (Nothing in Visual Basic).

- or -

An error occurred while executing the handler specified by path.

ArgumentNullException

path is a null reference (Nothing in Visual Basic).

- or -

path is not a virtual path.

The following example shows how to execute the .aspx page Updateinfo.aspx in the current request and preserve the QueryString and Form collections. Program execution returns to the starting page after Updateinfo.aspx is displayed.

private void Page_Load(Object sender, EventArgs e)
{
    Server.Execute("updateinfo.aspx", true);
} 

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

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show: