Session behaving like FIFO queue in

Discussion in 'ASP .Net' started by Mark, Dec 13, 2006.

  1. Mark

    Mark Guest

    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,
    dicDonation.Add("strVar1", "strValue1");

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

    //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?

    Mark, Dec 13, 2006
    1. Advertising

  2. Mark

    Mark Guest

    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?

    Mark, Dec 13, 2006
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page