Link to home
Start Free TrialLog in
Avatar of tbaseflug
tbaseflugFlag for United States of America

asked on

session - read and write values: HttpContext.Current.Session

What is the best way to read and write a value to a session - is the below correct to write to?

HttpContext.Current.Session["username"] = Convert.ToString(dr["us_username"]);
ASKER CERTIFIED SOLUTION
Avatar of Carl Tawn
Carl Tawn
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mrichmon
mrichmon

That is fine.  Or you can create an object if you are storing more than just a username.

Although if just a username you should consider using the built in principals like User.Identity.Name - rather than storing your own version of loginin