E
eSapient
My objective was to implement a 'Wait' page by using a combination of
an asynchronous call and a Session variable to signal the end of the
wait.
My first page has:
---------------------------------------------------------------
private void cmdSubmit_Click(object sender, System.EventArgs e)
{
Thread LongProcessThread = new Thread(new ThreadStart(LongProcess));
Session["Progress"] = "";
LongProcessThread.Start();
Session["NextPage"] = "Wait.aspx";
Response.Redirect("Wait.aspx");
}
private void LongProcess()
{
Random rand = new Random();
// long process simulation:
Thread.Sleep(5000 + (int)(10000.0 * rand.Next() / Int32.MaxValue));
Session["NextPage"] = "JobSubmitted.ASPx";
}
---------------------------------------------------------------
My second 'Wait' page has:
---------------------------------------------------------
private void Page_Load(object sender, System.EventArgs e)
{
if (null == Session["NextPage"])
Response.End();
string strNextPage = Session["NextPage"].ToString();
if ("" == strNextPage || "wait.aspx" == strNextPage.ToLower())
{
lblProgress.Text = Session["Progress"] + char.ToString((char)9608);
Session["Progress"] = lblProgress.Text;
}
else
Response.Redirect(strNextPage);
}
---------------------------------------------------------
These two pages work well and do what I want.
The problem now is that I want the second/wait page to be shared by
different applications. The above code would not work since Session
variables do not persist across applications. Any ideas, suggestions,
solutions?
TIA.
an asynchronous call and a Session variable to signal the end of the
wait.
My first page has:
---------------------------------------------------------------
private void cmdSubmit_Click(object sender, System.EventArgs e)
{
Thread LongProcessThread = new Thread(new ThreadStart(LongProcess));
Session["Progress"] = "";
LongProcessThread.Start();
Session["NextPage"] = "Wait.aspx";
Response.Redirect("Wait.aspx");
}
private void LongProcess()
{
Random rand = new Random();
// long process simulation:
Thread.Sleep(5000 + (int)(10000.0 * rand.Next() / Int32.MaxValue));
Session["NextPage"] = "JobSubmitted.ASPx";
}
---------------------------------------------------------------
My second 'Wait' page has:
---------------------------------------------------------
private void Page_Load(object sender, System.EventArgs e)
{
if (null == Session["NextPage"])
Response.End();
string strNextPage = Session["NextPage"].ToString();
if ("" == strNextPage || "wait.aspx" == strNextPage.ToLower())
{
lblProgress.Text = Session["Progress"] + char.ToString((char)9608);
Session["Progress"] = lblProgress.Text;
}
else
Response.Redirect(strNextPage);
}
---------------------------------------------------------
These two pages work well and do what I want.
The problem now is that I want the second/wait page to be shared by
different applications. The above code would not work since Session
variables do not persist across applications. Any ideas, suggestions,
solutions?
TIA.