Implementing a custom SessionIDManager

╄→尐↘猪︶ㄣ 提交于 2019-12-01 07:07:51

问题


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?


回答1:


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


来源:https://stackoverflow.com/questions/4612310/implementing-a-custom-sessionidmanager

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!