Export (0) Print
Expand All

HttpServerUtility.Execute Method

Executes the current request using another page.

Overload List

Executes the current request using another page at the specified URL path.

[Visual Basic] Overloads Public Sub Execute(String)
[C#] public void Execute(string);
[C++] public: void Execute(String*);
[JScript] public function Execute(String);

Executes the current request using another page at the specified URL. A TextWriter captures output from the page.

[Visual Basic] Overloads Public Sub Execute(String, TextWriter)
[C#] public void Execute(string, TextWriter);
[C++] public: void Execute(String*, TextWriter*);
[JScript] public function Execute(String, TextWriter);

Example

The following example executes the aspx page "Login.aspx" on the server in the current directory and receives the output from the page through the StringWriter object writer. It writes the HTML stream received from writer to the HTTP output stream.

[Visual Basic] 
Dim writer As New StringWriter
Server.Execute("Login.aspx", writer)
Response.Write("<H3>Please Login:</H3><br>" & writer.ToString())
   

[C#] 
StringWriter writer = new StringWriter();
Server.Execute("Login.aspx", writer);
Response.Write("<H3>Please Login:</H3><br>"+ writer.ToString());
   

[C++] 
StringWriter* writer = new StringWriter();
Server->Execute(S"Login.aspx", writer);
Response->Write(String::Format(S"<H3>Please Login:</H3><br>{0}", writer));
   

[JScript] 
var writer : StringWriter = new StringWriter()
Server.Execute("Login.aspx", writer)
Response.Write("<H3>Please Login:</H3><br>" + writer.ToString())
   

See Also

HttpServerUtility Class | HttpServerUtility Members | System.Web Namespace

Show:
© 2014 Microsoft