0

I'm using ASP.NET SessionState provider for my web application.

I configured it by placing the following code in my web.config file:

<sessionState mode="Custom" customProvider="DefaultSessionProvider" allowCustomSqlDatabase="true" timeout="60" cookieless="false">
      <providers>
        <add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=200e8383838" connectionStringName="SessionConnection" />
      </providers>
    </sessionState>

It placed a "Sessions" table in the database that I specified in the "SessionConnection" connection string. One of the columns in the table is "Locked." Occasionally when testing my code the locked attribute is set to true and I can no longer run the app until I manually set the value back to false.

What causes the locked attribute to be set to true? I noticed after encountering an exception it sometimes triggers this. I don't want users to get locked out of the web when it's in production so what can I do to avoid this?

rin102102
  • 21
  • 2
  • For a start a session can't lock you out of a site. I assume you are running into [this](https://stackoverflow.com/questions/27957295/what-are-the-lock-free-sessions-in-c). It also sounds like you need to handle your exceptions properly. – Dale K Jul 21 '20 at 20:31
  • When the session is locked and I try to run the app it just hangs on loading. Once I manually update the locked value to false in SQL Management Studio the app immediately loads again. Are exceptions the only thing that causes a session to be locked? Also, why doesn't the lock free-up after a while? – rin102102 Jul 21 '20 at 20:46

0 Answers0