Solved - SessionID storage in database

Posted on 2004-11-01
Last Modified: 2012-05-05
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
Question by:Psychotext
    LVL 25

    Accepted Solution

    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


    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

    LVL 2

    Author Comment

    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.
    LVL 5

    Expert Comment

    I see no nose on their avatars, jk :)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone. Privacy Policy Terms of Use

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    When developing different types of ASP.NET applications I often face a requirement to let user download different types of files. They vary from logs in *.txt files or manuals/instructions in *.pdf files to charts in *.jpg files or reports in *.xls …
    ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
    This video Micro Tutorial is the first in a two-part series that shows how to create and use custom scanning profiles in Nuance's PaperPort 14.5 ( But the ability to create custom scanning profiles al…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…

    860 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

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now