Over Write Value in Session State?

L

Leon

Can you write over a value in session or do you have to delete the value
first then re-create it?

**Example:
I have the following value in session state...
Statement 1 -- Session.Add("Email", "someone@ someplace.com ")

And I want to change it to the following value...
Statement 2 -- Session.Add("Email", "someone@ msn.com ")

Do I just execute statement 2 or do I have to delete statement 1 first?
 
K

Kevin Spencer

Session("Email") = "(e-mail address removed)"

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.
 
G

Guest

Leon,

A sure bet is to reference the value directly as in the following:

C#:
Session["itemname"] = value;

VB.Net:
Session("itemname") = value

This method of accessing the session will set the original value, or
overright the value previously contained in the session.

Thanks,
Ian Suttle
http://www.IanSuttle.com
 

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

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top