Server.Execute : Server class « Server « ASP.Net






Server.Execute


<%@Import namespace="System.IO" %>
<script runat="server" language="C#">
protected void Page_Load(object o, EventArgs e) {
    Response.Write("the current execution file path is:");
    Response.Write(Request.CurrentExecutionFilePath + "<br>");

    Response.Write("the Server.Execute file path is:");
    StringWriter sw = new StringWriter();
    Server.Execute("NextPage.aspx", sw);
    Response.Write(sw.ToString() + "<br>");
}
</script>

File: NextPage.aspx

<script runat="server" language="C#">
protected void Page_Load(object o, EventArgs e) {
    Response.Write(Request.CurrentExecutionFilePath);
}
</script>

 








Related examples in the same category

1.Use the Server.Transfer method to transfer control and values from one page to another.