Sharing ASP.NET session info between applications in a single application pool and worker process

StackOverflow https://stackoverflow.com/questions/22873430

  •  28-06-2023
  •  | 
  •  

Question

Can ASP.NET applications in a common application pool share session information if they are in separate threads in a single worker process? One of my applications is having issues related to not having any of the session information it needs from the other application, but I used Trace.axd to confirm that requests to each application are using the same session identifier.

Was it helpful?

Solution

I resolved the issues we were experiencing by making our applications "cookieless". I updated the web.config file for the applications as follows:

<!--sessionState mode="InProc" cookieless="false" timeout="30" /-->
<sessionState mode="InProc" cookieless="true" timeout="30" />

If anyone can explain why this works, I would appreciate the education.

Thank you to all who offered suggestions.

OTHER TIPS

ASP.NET session is scoped "within" application if using out-of-the-box session providers, so each application will have its own session even if the session id/key value appears to be the same. But since the requests to each application are using the same session identifier value, you appear to be well set to implement a custom SessionStateStoreProvider that can store/retrieve data using this identifier across both applications.

You could also have a look at Sharing sessions across applications using the ASP.NET Session State Service, but since this approach involves modifying the workings of the stock SQL session store provider, you'd risk spillover effects on other sites/applications.

I thik it could be helpfull Sharing Aspnet Session across different domains there's no other way. you cannot share a session between different domain.

there's another solution that could be pass all data via querystring to the other domain so it can rebuild the right session values.

Personally i will invite you to use encrypted value to be sure that are not visibile if you will choose GET option.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top