我正在尝试实现一个非常类似于此示例的自定义SessionIDManager .
我把它放在web.config中,类似于他们在示例中显示的内容:
<system.web>
<httpModules>
<add name="SessionID"
type="ProjectName.WebUI.Models.CustomSessionIDManager" />
</httpModules>
// --snip--
</system.web>
Run Code Online (Sandbox Code Playgroud)
但是,当尝试加载网站时,我收到配置错误:
ProjectName.WebUI.Models.CustomSessionIDManager未实现IHttpModule.
如果我删除web.config的那一部分,网站会加载,但自定义SessionIDManager的重写部分不会运行.
如何正确告诉web.config使用我的自定义SessionIDManager?
事实上,我认为文档中存在一个错误.您不需要将其添加到该<httpModules>
部分,而是添加到此处所示的<sessionState>
部分:
<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"
/>
Run Code Online (Sandbox Code Playgroud)