Session behaving like FIFO queue in asp.net

M

Mark

Hi All

I'm trying to add a dictionary object and a stack (C#) to the Session
state as follows:

//Create Dictonary object and add 1 kvp
Dictionary<String, String> dicDonation = new Dictionary<String,
String>();
dicDonation.Add("strVar1", "strValue1");

//Create Stack object and add 1 kvp
Stack<String> PQStack = new Stack<String>();
PQStack.Push("donations");

//Commit objects to Session state
Session["Donations"] = dicDonation;
Session["PQStack"] = PQStack;
Session["test1"] = "Test1";
Session["test2"] = "Test2";

I added some simple test strings at the bottom as well. When I step
through this in debug mode, I can see the Donations dictionary added to
Session. But, when PQStack is added Donations is immediately removed.
The next test strings work the same way; test1 pushes PQStack out, then
test2 pushes test1 out. Bottom line is I'm only ever left with the
last kvp I put in Session. Any ideas?

Thanks
Mark
 
M

Mark

Actually I found that this has nothing to do with stack and dictionary
objects. If I try to commit simple strings, it behaves the same:

Session["test1"] = "test1"
Session["test2"] = "test2"
Session["test3"] = "test3"

At the end, I'm left only with [test3] in Session. Wonder if it has
anything to do with state mngt on the ASP developer web server built
into VS?

Thanks
Mark
 

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

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top