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"
/>
精彩评论