为什么我的 SessionIDManager 子类没有被要求 CreateSessionID?

发布于 2024-09-02 05:46:10 字数 1405 浏览 1 评论 0原文

我已经按照以下说明使用会话状态管理实现了一个 Web 应用程序:

http://blog.maartenballiauw.be/post/2008/01/ASPNET-Session-State-Partitioning-using-State-Server-Load-Balancing.aspx

http://en.aspnet-bhs.info/ post/State-Server-Partitioning.aspx

我的 SessionIDManager 继承者包含以下代码:

public class SessionIdManager : System.Web.SessionState.SessionIDManager
{
    public override string CreateSessionID(System.Web.HttpContext context)
{...}

我的 web.config 包含以下代码:

<machineKey
          validationKey="1234567890123456789012345678901234567890AAAAAAAAAA"
          decryptionKey="123456789012345678901234567890123456789012345678"
          validation="SHA1"
          decryption="Auto"
        />
...
<sessionState
            mode="StateServer"
            partitionResolverType="PartitionResolver"
            sessionIDManagerType="SessionIdManager"
            cookieless="false"
            timeout="20"
            />

但 CreateSessionID 方法永远不会被调用,因此会话 ID 不会使用适当的服务器 ID 进行修改。

有人可以告诉我发生了什么事或者我可能还需要考虑文章中没有提到的事情吗?

我正在使用 .NET2 和 VS2k5。

谢谢,

马特。

I have implemented a web app using session state management as per the instructions found on:

http://blog.maartenballiauw.be/post/2008/01/ASPNET-Session-State-Partitioning-using-State-Server-Load-Balancing.aspx

http://en.aspnet-bhs.info/post/State-Server-Partitioning.aspx

My SessionIDManager inheritor includes the code:

public class SessionIdManager : System.Web.SessionState.SessionIDManager
{
    public override string CreateSessionID(System.Web.HttpContext context)
{...}

My web.config includes the code:

<machineKey
          validationKey="1234567890123456789012345678901234567890AAAAAAAAAA"
          decryptionKey="123456789012345678901234567890123456789012345678"
          validation="SHA1"
          decryption="Auto"
        />
...
<sessionState
            mode="StateServer"
            partitionResolverType="PartitionResolver"
            sessionIDManagerType="SessionIdManager"
            cookieless="false"
            timeout="20"
            />

But the CreateSessionID method never gets called and so the session IDs do not get amended with the appropriate server ID.

Can someone tell me what is going on or what I might also need to consider that isn't mentioned in the articles?

I am using .NET2 with VS2k5.

Thanks,

Matt.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

握住我的手 2024-09-09 05:46:10

我在 Validate(string id) 方法中添加了对会话 ID 字符串长度的检查。现在它有: return id.Length != 24;这似乎有效。

I have added a check in the Validate(string id) method the length of the session ID string. It now has: return id.Length != 24; This seems to work.

高冷爸爸 2024-09-09 05:46:10

Validate(string id) 函数中,如果您不希望 ASP 框架创建新会话,则应始终返回 true

In the Validate(string id) function, you should always return true if you don't want the ASP framework to create a new session.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文