By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,310 Members | 1,951 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,310 IT Pros & Developers. It's quick & easy.

Quick question

P: n/a
Hi

In a session key add such as:

Session.Add("CustId", userId);

if i then called that again so say i did this

Session.Add("CustId", userId);

Session.Add("CustId", userId);

Would it overwrite the first one with the valaue of the second one, or does
it somehow add the session variable twice? If it does add it twice how do i
make it overwrite the old one if the old one doesnt exist already and if it
does. Thanks.
Mar 28 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Overwrite.

--
~~~~~~~~~~~
Ben Rush
http://www.ben-rush.net/blog
"PokerMan" <no****@pokercat.co.ukwrote in message
news:ea*************@TK2MSFTNGP05.phx.gbl...
Hi

In a session key add such as:

Session.Add("CustId", userId);

if i then called that again so say i did this

Session.Add("CustId", userId);

Session.Add("CustId", userId);

Would it overwrite the first one with the valaue of the second one, or
does it somehow add the session variable twice? If it does add it twice
how do i make it overwrite the old one if the old one doesnt exist already
and if it does. Thanks.


Mar 28 '07 #2

P: n/a
On Mar 28, 4:47 pm, "PokerMan" <nos...@pokercat.co.ukwrote:
Hi

In a session key add such as:

Session.Add("CustId", userId);
Also this syntax in in general terms slightly more sexy:
Session["x"] = someVariable;

....

--
http://ajaxwidgets.com
ASP.NET 2.0 Ajax Widgets

Mar 28 '07 #3

P: n/a
Yes, in this case it would overwrite the previous value.

--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net
"PokerMan" <no****@pokercat.co.ukwrote in message
news:ea*************@TK2MSFTNGP05.phx.gbl...
Hi

In a session key add such as:

Session.Add("CustId", userId);

if i then called that again so say i did this

Session.Add("CustId", userId);

Session.Add("CustId", userId);

Would it overwrite the first one with the valaue of the second one, or
does it somehow add the session variable twice? If it does add it twice
how do i make it overwrite the old one if the old one doesnt exist already
and if it does. Thanks.

Mar 28 '07 #4

P: n/a
much love to you guys, thought so, thanks!
"PokerMan" <no****@pokercat.co.ukwrote in message
news:ea*************@TK2MSFTNGP05.phx.gbl...
Hi

In a session key add such as:

Session.Add("CustId", userId);

if i then called that again so say i did this

Session.Add("CustId", userId);

Session.Add("CustId", userId);

Would it overwrite the first one with the valaue of the second one, or
does it somehow add the session variable twice? If it does add it twice
how do i make it overwrite the old one if the old one doesnt exist already
and if it does. Thanks.


Mar 28 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.