Go Premium for a chance to win a PS4. Enter to Win


ASP.net - SessionID storage in database

Posted on 2004-11-01
Medium Priority
Last Modified: 2012-05-05
Have googled around but can't seem to find an answer.  Need to store the asp.net session ID in a sql server table but I can't work out the best datatype to store it with.  From what I've been able to find out, it's a hex 120 bit string.  Anyone got any ideas?  Thanks
Question by:Psychotext
LVL 25

Accepted Solution

nauman_ahmed earned 600 total points
ID: 12469541
You can use VARCHAR 32 to store the session id. You can retrieve the session id using Session.SessionID.ToString().

Best, Nauman.
LVL 20

Assisted Solution

ihenry earned 400 total points
ID: 12469619

HttpSessionState.SessionID data type is String, so you can just use nvarchar with a certain length. Or use char(32) as Microsoft use it for the Sql Server mode session state. like this

Dim p As New SqlParameter( "@SessionID",  sessionId )
p.SqlDbType = SqlDbType.Char
p.Size = 32


Author Comment

ID: 12469791
Thanks both.  Nauman wins this one by a nose, but I've also awarded ihenry some points for the additional info relating to the SQL server session state.

Expert Comment

ID: 21327761
I see no nose on their avatars, jk :)

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

916 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