Session.Add method - what if called multiple times with the same k

Discussion in 'ASP .Net' started by Guest, Jan 28, 2005.

  1. Guest

    Guest Guest

    I wonder what is happening if you subsequently use the session.add method
    with the same key, but different values.

    e.g. if I do;
    session.add("MyVar", "a")
    session.add("MyVar", "b")

    then; session("MyVar").tostring will return "b"

    Is the value you are adding ("b") simply replacing the olde value ("a")
    If so, should the name of the method then not be something like session.set,
    because you are not actually adding anything.

    Can't find anything about this in the documentation. Some explaination is
    appreciated.
     
    Guest, Jan 28, 2005
    #1
    1. Advertisements

  2. Hi,

    I believe it is because of MS wants to reduce the number of
    properties/methods etc.,
    and It makes sense when assuming that Session is a memory area ( like a
    container)
    where you will add up all your values. "Set" sounds to be setting some thing
    with determined manner.

    Hope, this makes sense :)

    Cheers!
     
    Vadivel Kumar, Jan 28, 2005
    #2
    1. Advertisements

  3. Guest

    T Saravana MMPatti

    Joined:
    Dec 16, 2011
    Messages:
    1
    Likes Received:
    0
    We can add more session with same key value

    Hi ,

    I was also same doubt like this. i have implemented this scenario in my client application. it is working fine. So
    :thrasher::thrasher::thrasher:

    Regards

    Saravanakumar T, M.M.Patti Coimbatore.



     
    T Saravana MMPatti, Dec 16, 2011
    #3
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.