Hi,

I am getting an exception from within the Coolite StateProvider when using SQL out-of-process session states. My application is merely performing a Server.Transfer to a default error page, but it actually fails performing this step. Looking at the stack trace, it's failing within the Coolite toolkit at the location stated below.

After some Googling, I've determined that it could be any of the following reasons:

1. Breaking change in .NET 3.5 which could be fixed by SP1 (it didn?t, at least not on my machine)
2. Something that could be fixed by running IIS7 and turning on integrated pipeline mode (I?m on XP, so no IIS7)
3. Something totally different and this is a red herring.

Has anybody encountered this particular problem?


public virtual StateProvider StateProvider
        {
            get
            {
                if (this.stateProvider != null)
                {
                    return (StateProvider)this.stateProvider;
                }

                if (this.IsMVC && (this.stateProvider == null || (StateProvider)this.stateProvider == StateProvider.PostBack))
                {
                    this.stateProvider = StateProvider.None;
                    return (StateProvider)this.stateProvider;
                }

                if (!this.DesignMode)
                {
                    string token = "Coolite.StateProvider";

                    object obj = HttpContext.Current.Application[token];

                    if (obj == null)
                    {
                        obj = HttpContext.Current.Session[token];  <- Exception occurs here. Session is null.
                    }

                    if (obj != null &amp;&amp; obj is StateProvider)
                    {
                        this.stateProvider = (StateProvider)obj;
                        return (StateProvider)this.stateProvider;
                    }
                }
                else
                {
                    this.stateProvider = WebConfigUtils.GetStateProviderFromWebConfig(this.Site);
                    return (StateProvider)this.stateProvider;
                }

                this.stateProvider = GlobalConfig.Settings.StateProvider;
                return (StateProvider)this.stateProvider;
            }
            set
            {
                this.stateProvider = value;
            }
        }