Search code examples
asp.netsubdomainsingle-sign-onforms-authenticationsession-variables

asp.net persisting session variables across sub-domains


I have two ASP.NET applications using Forms Authentication and Single Sign On and I would like to persist Session variables between them.

Upon testing, I cant seem to get the Session variables to be read from the other application. Both apps are on the same domain (app1.domain.com & app2.domain.com) and I have set up my config (a.f.a.i.k.) correctly to reflect this.

I have noticed that when testing on the release server the session id is different even when using tab pages on the same browser (I thought they would be the same!), yet debugging on my local IIS the session id is the same (and I still cant read session variables across sub-domains).

Anyone got any pointers to what I may have missed?

Best Regards


Solution

  • By default, SessionState mode is InProc which means Session State data is stored in each AppDomain's memory. AppDomains are isolated, and they do not share SessionState.

    You need SQLServer or StateServer as SessionState mode.