470,636 Members | 1,526 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,636 developers. It's quick & easy.

Passing session data across applications.

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.
Nov 18 '05 #1
1 2091
Hi,

You can persist the session data in Database or additionally persist the
session data in memory map file. You can use Microsoft cache application
block to store and retrieve data from memory map file. :

http://msdn.microsoft.com/library/de.../en-us/dnpag/h
tml/CachingBlock.asp

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Brad | last post: by
4 posts views Thread by Cowboy \(Gregory A. Beamer\) | last post: by
3 posts views Thread by Mark | last post: by
1 post views Thread by guoqi zheng | last post: by
2 posts views Thread by Roy | last post: by
1 post views Thread by Korara | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.