Why is my SessionIDManager child class not being asked to CreateSessionID?

1.7k Views Asked by At

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.

2

There are 2 best solutions below

0
On BEST ANSWER

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.

0
On

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