加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c# – 实现自定义SessionIDManager

发布时间:2020-12-16 01:40:09 所属栏目:百科 来源:网络整理
导读:我正在尝试实现一个非常类似于 this example的自定义SessionIDManager. 我把它放在web.config中,类似于他们在示例中显示的内容: system.web httpModules add name="SessionID" type="ProjectName.WebUI.Models.CustomSessionIDManager" / /httpModules // -
我正在尝试实现一个非常类似于 this example的自定义SessionIDManager.

我把它放在web.config中,类似于他们在示例中显示的内容:

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

但是,当尝试加载网站时,我收到配置错误:

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

如果我删除web.config的那一部分,网站会加载,但自定义SessionIDManager的重写部分不会运行.

如何正确告诉web.config使用我的自定义SessionIDManager?

解决方法

事实上,我认为文档中存在一个错误.您无需将其添加到< httpModules>但是对于< sessionState>部分为 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"
/>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读