简体   繁体   中英

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?

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"
/>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM