Session Timeout Resetting to 20 mins


I'm using SQL Server session state mode with a timeout set to 40 minutes. When I establish the session in ASP.NET, I can see the session timeout set to 40 in the database. When I access NSession.Session from classic ASP the session timeout is updating itself to 20 minutes in the database.


bstricherz wrote Apr 29, 2015 at 5:06 PM

I downloaded the source and was able to recreate using the NSessionTest project with the following steps:
  1. Change the web.config file to use <sessionState mode="SQLServer" sqlConnectionString=".." timeout="40/>
  2. Browse to the Test.aspx page
  3. Check database table storing session state, Timeout = 40
  4. Browse to Test.asp page
  5. Check database table, Timeout = 20

dotneteer wrote Apr 30, 2015 at 5:39 AM

bstricherz, are you running the latest I fixed it in the version. I just tried your steps, but the SQL Server shows that the Timeout is 40.

bstricherz wrote Apr 30, 2015 at 8:58 PM

I found my issue, even though I had used regasm and regsvr32 to unregister the old version and register the new version, I still had in the GAC. Once I figured that out, it works. Thanks.

By the way, I added a bit of info to the NSessionDiagnostics.aspx page to help track it down. I modified line 136:
var versionInfo = FileVersionInfo.GetVersionInfo(managedNSessionType.Assembly.Location);
Response.Write(String.Format("<p>Managed NSession.dll v{0} registered correctly.</p>", versionInfo.FileVersion));

dotneteer wrote Apr 30, 2015 at 10:20 PM

Thanks for the suggestion for the NSessionDiagnostics.aspx page. GAC is always confusing. That is why in my latest doc I suggest to use the /codebase option to register the assembly instead of adding it to GAC:

regasm /tlb /codebase NSession.dll

dotneteer wrote May 31, 2015 at 10:07 PM

Your suggestion is incorporated into Thanks.