Solved

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

Posted on 2010-09-07
2
381 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
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.
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.

776 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