Solved

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

Posted on 2010-09-07
2
383 Views
Last Modified: 2013-11-27
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"]);
0
Comment
Question by:tbaseflug
2 Comments
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 500 total points
ID: 33620018
Yes, what you have is fine.
0
 
LVL 35

Expert Comment

by:mrichmon
ID: 33620504
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
0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question