ASP.net - SessionID storage in database

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
LVL 2
PsychotextAsked:
Who is Participating?
 
nauman_ahmedConnect With a Mentor Commented:
You can use VARCHAR 32 to store the session id. You can retrieve the session id using Session.SessionID.ToString().

Best, Nauman.
0
 
ihenryConnect With a Mentor Commented:

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

0
 
PsychotextAuthor Commented:
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.
0
 
fmonroyCommented:
I see no nose on their avatars, jk :)
0
All Courses

From novice to tech pro — start learning today.