-->

SessionId saved in SQL Server is different from th

2019-07-21 00:40发布

问题:

I have implemented SQL Server session mode for an asp.net application.

<sessionState mode="SQLServer" compressionEnabled="true" 
        sqlConnectionString="Data Source=.;User ID=xxxx;Password=yyyyy;Integrated Security=False;" 
        sqlCommandTimeout="240" allowCustomSqlDatabase="true" cookieless="false" />

I created a variable in the Session_Start in the global.asax file:

var sessionID = Session.SessionID;

I found the following data while debugging the application:

ASP.NET generated : lehxv4so4ioi2gqqaxtjzhyo
SQL Server saved  : lehxv4so4ioi2gqqaxtjzhyo84497b6f

Can anyone let me know what is reason for the different results as mentioned above.

回答1:

lehxv4so4ioi2gqqaxtjzhyo84497b6f

in bold is your sessionid and in italics is the application id

the extra 8 bytes are the applicationid