Passing session data across applications.

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top