I need to share asp.net session between 2 websites on same IIS.

  • I created a custom session db and hijacked the stored procedure to return same appID regardless of app or url.

  • I created a connection string for the db in web.config:

< add name="dbConnSession" connectionString="server=xx.xxx.xx.xx.;database=ASPNETSession;User Id=xxx;Password=xxx" providerName="System.Data.SqlClient" />

  • Then I defined session state:

< sessionState allowCustomSqlDatabase="true" cookieless="AutoDetect" mode="SQLServer" sqlCommandTimeout="10" sqlConnectionString="dbConnSession" timeout="120" sqlConnectionRetryInterval="2" />

I developed the sites on my Win7 machine with IIS7 and login system works perfectly. I can login from 1 site, go to other site and stay logged in.

I moved 2 sites into the web server (windows 2012 with IIS8.5) and the shared session does not work. Sites simply does not share the session. I set a session value on one site and try to see it on the other and session value returns as null. The very same test page works on IIS7.

Does anyone know why IIS8.5 has trouble with something works on IIS7?

Related posts

Recent Viewed