- SessionID storage in database

Have googled around but can't seem to find an answer.  Need to store the 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
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.
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

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

From novice to tech pro — start learning today.