0

I have two ASP.NET Web apps in same machine;

1) ASP.NET WebForm web app - wwwroot/publicsite
2) ASP.NET MVC web app – wwwroot/test/mysite

I can create an application pool and set it to both web app.

Is there any simple way to share session between two web apps without using custom session provider through DB?
(like modifying web.config and so)

Best regards.

Ivoryguard
  • 155
  • 1
  • 8
  • are you after a yes/no answer? – jazb Aug 12 '19 at 06:08
  • Duplicate question, [Sharing sessions across applications using the ASP.NET Session State Service](https://stackoverflow.com/questions/2868316/sharing-sessions-across-applications-using-the-asp-net-session-state-service) – AlwaysLearning Aug 12 '19 at 06:12
  • Could you try this url https://stackoverflow.com/questions/2868316/sharing-sessions-across-applications-using-the-asp-net-session-state-service?noredirect=1&lq=1 – Ravi Kumar Kasim Aug 12 '19 at 10:34
  • Unfortunately, it seems to be not duplicated question. Above links are for custom session provider using SQL Server. I do not want it because I have to support multiple DB like MSSQL, Oracle and MySQL. Current my research says “no”. – Ivoryguard Aug 13 '19 at 07:12

1 Answers1

0

So, i don't have this developed yet, so i'll describe the scenario and when i have it coded i can edit this answer, but short term here it is:

You can edit your page class (and use that custom page class or HttpApplication class) to "save" the session objects using serialization into a cookie, and get that cookie on load (or begin request if set on the httpapplication) of a page. So any site would query the same cookies for session objects (since the SessionState class is basically a collection of objects - see MSDN Code Page for SessionState). All you need if for both applications to use the same base class with the custom Page (or HttpApplication) class that serializes and deserialize the session objects on Begin Request and Write Response times.

SammuelMiranda
  • 420
  • 4
  • 29