Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Implementing a custom SessionIDManager

I'm trying to implement a custom SessionIDManager very similar this example.

I'm putting this in the web.config similar to how they showed in the example:

<system.web>
  <httpModules>
    <add name="SessionID"
         type="ProjectName.WebUI.Models.CustomSessionIDManager" />
  </httpModules>
  // --snip--
</system.web>

However when attempting to load the website I am getting the configuration error:

ProjectName.WebUI.Models.CustomSessionIDManager does not implement IHttpModule.

If I remove that part of the web.config, the website loads, but the overridden part of the custom SessionIDManager does not get run.

How do I properly tell the web.config to use my custom SessionIDManager?

like image 564
Sgraffite Avatar asked Feb 25 '23 10:02

Sgraffite


1 Answers

In fact I think there's a bug in the documentation. You don't need to add it to the <httpModules> section but to the <sessionState> section as illustrated here:

<sessionState
    Mode="InProc"
    stateConnectionString="tcp=127.0.0.1:42424"
    stateNetworkTimeout="10"
    sqlConnectionString="data source=127.0.0.1;Integrated Security=SSPI"
    sqlCommandTimeout="30"
    customProvider=""
    cookieless="false"
    regenerateExpiredSessionId="false"
    timeout="20"
    sessionIDManagerType="Your.ID.Manager.Type, CustomAssemblyNameInBinFolder"
/>
like image 103
Darin Dimitrov Avatar answered Mar 07 '23 23:03

Darin Dimitrov