SessionID length differs between .NET and SQL Server

Discussion in 'ASP General' started by Mark Meyers, Jul 20, 2010.

  1. Mark Meyers

    Mark Meyers Guest

    I have no clue what is happening and hope someone can explain this.

    I have my Web site set up to use SQL Server session state. This works fine.
    When a session starts, a row is created in ASPStateTempSessions.

    When the user logs off the application, I am trying to call the stored
    procedure TempRemoveStateItem to clean up after myself (not sure if this is
    the right way to do it or not).

    What I noticed is that the SQL table's SessionID column contains 32
    characters whereas the .NET Session.SessionID value only contains 24
    characters (which match the first 24 characters of the 32 characters stored
    in the SQL table). Because the values do not match, the stored procedure
    always fails.

    Why would the SessionID value differ between .NET and SQL?
    Mark Meyers, Jul 20, 2010
    1. Advertisements

  2. Mark Meyers

    Dan Guest

    This newsgroup is about classic ASP, not ASP.NET. You might have more chance
    of an answer in the relevant dotnet group.

    Personally, I've never looked into it. Without any example values to look at
    it's hard to make an educated guess (I don't have an ASP.NET site to tinker
    with either), but I would take a stab that the extra characters are an
    identifier used to differentiate between servers in a farm, or multiple
    sites in a single server, to prevent SessionID collisions across different
    sites/servers. Do the extra characters bear any relation to the IIS site
    Dan, Jul 21, 2010
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.