实现自定义SessionIDManager [英] Implementing a custom SessionIDManager

查看:493
本文介绍了实现自定义SessionIDManager的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想实现一个自定义SessionIDManager非常相似的<一个href=\"http://msdn.microsoft.com/en-us/library/system.web.sessionstate.sessionidmanager.validate.aspx\"相对=nofollow>这个例子。

I'm trying to implement a custom SessionIDManager very similar this example.

我把这个类似于在web.config他们的例子,如何显示:

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没有实现IHttpModule的。

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

如果我删除了web.config文件,该网站负荷,但自定义SessionIDManager没有得到运行的部分覆盖的那部分。

If I remove that part of the web.config, the website loads, but the overridden part of the custom SessionIDManager does not get run.

我如何正确地告诉web.config中使用个性化的SessionIDManager?

How do I properly tell the web.config to use my custom SessionIDManager?

推荐答案

事实上,我认为有文件中的错误。你并不需要把它添加到&LT;的HttpModules&GT; 部分,但到&LT;的sessionState&GT; 部分作为<一href=\"http://msdn.microsoft.com/en-us/library/system.web.sessionstate.sessionidmanager.createsessionid.aspx\">illustrated这里:

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

这篇关于实现自定义SessionIDManager的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆