Click here to Skip to main content
15,884,472 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
I have an asp webform called default.aspx and a 2nd called webform1.aspx. After logging in with default.aspx I would like to call webform1 multiple times from default.aspx passing Session variables back and forth. To test this I created a simple web application with my two forms as shown below:

Server.Execute calls webform1.aspx but the webform1 page does not display. It returns to the line after the server.execute statement after executing. I need the webform1 page to display each time it is called so that I can accept inputs. Can some let me know what I am doing wrong?

regards
Pat


default.aspx.cs
public partial class _Default : Page
{
string status="active";
protected void Page_Load(object sender, EventArgs e)
{

}

protected void Button1_Click(object sender, EventArgs e)
{
while(status == "active")
{
Server.Execute("~/WebForm1.aspx");
}
}

webform1.aspx.cs
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}

protected void Button1_Click(object sender, EventArgs e)
{
return;
}
}
Posted

1 solution

Server.Execute calls the page code in a background thread. To basically navigate to a new page you will need to use Server.Redirect(). This will pass the execution to the next page. From there you will need to then Redirect back to the original page to create the page loop.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900