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

Discussion in 'ASP .Net' started by =?Utf-8?B?TWFydGlu?=, Jan 28, 2005.

  1. 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.
    =?Utf-8?B?TWFydGlu?=, Jan 28, 2005
    #1
    1. Advertising

  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!

    "Martin" <> wrote in message
    news:...
    >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.
    Vadivel Kumar, Jan 28, 2005
    #2
    1. Advertising

  3. =?Utf-8?B?TWFydGlu?=

    T Saravana MMPatti

    Joined:
    Dec 16, 2011
    Messages:
    1
    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. 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. =?Utf-8?B?Sm9uYXRoYW4gRHVrZQ==?=

    Session provider - ResetItemTimeout called multiple times per page

    =?Utf-8?B?Sm9uYXRoYW4gRHVrZQ==?=, Jan 24, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    1,038
    =?Utf-8?B?Sm9uYXRoYW4gRHVrZQ==?=
    Jan 24, 2006
  2. djskrill
    Replies:
    9
    Views:
    686
    djskrill
    Oct 1, 2003
  3. Apricot
    Replies:
    4
    Views:
    510
    velthuijsen
    Apr 16, 2004
  4. Radu
    Replies:
    7
    Views:
    695
    charlie_Stell
    Aug 28, 2009
  5. mark belles
    Replies:
    4
    Views:
    371
    mark belles
    Jan 23, 2004
Loading...

Share This Page