Session behaving like FIFO queue in asp.net

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,
    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
     
    Mark, Dec 13, 2006
    #1
    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?

    Thanks
    Mark
     
    Mark, Dec 13, 2006
    #2
    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.
Similar Threads
  1. Russell Warren

    Is Queue.Queue.queue.clear() thread-safe?

    Russell Warren, Jun 22, 2006, in forum: Python
    Replies:
    4
    Views:
    727
    Russell Warren
    Jun 27, 2006
  2. chaitu
    Replies:
    0
    Views:
    1,026
    chaitu
    May 31, 2007
  3. chaitu
    Replies:
    1
    Views:
    991
    Mike Treseler
    May 31, 2007
  4. chaitu
    Replies:
    1
    Views:
    750
    quantum_dot
    Jun 1, 2007
  5. Kris
    Replies:
    0
    Views:
    538
Loading...

Share This Page