- 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?
You can use VARCHAR 32 to store the session id. You can retrieve the session id using Session.SessionID.ToString().

Best, Nauman.

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 :)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.