Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   Session.Add method - what if called multiple times with the same k (http://www.velocityreviews.com/forums/t95553-session-add-method-what-if-called-multiple-times-with-the-same-k.html)

=?Utf-8?B?TWFydGlu?= 01-28-2005 01:05 PM

Session.Add method - what if called multiple times with the same k
 
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 01-28-2005 01:17 PM

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

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" <unko@nowhere.net> wrote in message
news:3F6EFC55-556C-497C-91DB-3A23C81C0178@microsoft.com...
>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.




T Saravana MMPatti,CBE 12-16-2011 12:44 PM

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.



Quote:

Originally Posted by Vadivel Kumar (Post 431825)
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" <unko@nowhere.net> wrote in message
news:3F6EFC55-556C-497C-91DB-3A23C81C0178@microsoft.com...
>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.



All times are GMT. The time now is 06:48 PM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.