5

I have two web applications, one in .net 3.5 framework and another one in .net 4.0 framework (MVC with Razor). I have uploaded 3.5 framework application in main domain and 4.0 framework application in sub domain. I want to share session between this application. I am using session state mode as sql server. I tried solutions like applying application name in session sql server connection string and modify stored procedure TempGetAppID in ASPState database. It works perfect in local but when i upload to live it doesn't share session. Then I also tried cookie sharing between domains but its also not working. So i think it requires some change in server but i don't know where to make changes. Anybody can help?

Dhaval Panchal
  • 612
  • 4
  • 12
  • 32
Raj
  • 51
  • 2
  • 1
    Do they share the same App Pool (not sure if this matter but it's a best guess atm). Locally, I assume they would share the same App Pool which might be why it works. – webnoob Mar 01 '13 at 09:34
  • 1
    You must ensure that the 2 applications connect to the same database file - and have the same application id (on the database) – Aristos Mar 01 '13 at 10:06
  • Tried solutions mentioned in http://stackoverflow.com/a/3151315 and http://stackoverflow.com/a/2461502 ? –  Mar 01 '13 at 12:09
  • See the answer in this post: [Post][1]. Maybe this is helping you further... [1]: http://stackoverflow.com/questions/273732/how-can-i-share-a-session-across-multiple-subdomains-in-asp-net – Rinus van de Graaf Sep 18 '13 at 09:21

1 Answers1

0

One of the things that is most often different on production enviroments is that every app has its own machineKey. You can generate one with this generator and place the same into configs of both applications, so they can decrypt cookie from the other app. By default the session state has also cookie which contains session key, and to be able to share sessions, you should be first able to share cookies.

Goran Obradovic
  • 8,951
  • 9
  • 50
  • 79