Session sharing between two ASP.NET applications, where one is nested in the other

So, before you ask, "What the hell do you mean, one is embedded in the other?" I will explain it as simple as possible.

The .NET web application (A) was created. An additional application (B) has been created that works with some of the same major builds. The previous consulting company somehow โ€œinstalledโ€ application B as part of application A, so that B could overload session A. So, something like this:

- Application A (C:\Inetpub\wwwroot\ApplicationA) + Application B (C:\Inetpub\wwwroot\ApplicationA\sup\ApplicationB 

The previous company left zero documentation on how and why they did it, but it worked for them. My dilemma now is this: Appendix A has been upgraded, so B is useless. I updated B to start the new kernel provided by A, but by the time I was finished, another team had destroyed the previous production and testing servers, and I could not get a backup to see how it was configured.

After a number of problems, I was able to replicate the hierarchy above in a single IIS application and pool, dividing the web.config file by B and deleting duplicate sections - those that already exist on the .config network. I also dumped all the files from the B bin folder to the A bin folder.

Both sites are compiled and maintained by IIS, but I cannot read anything from session A using this structure. I am not surprised by this result, but I need to find a workaround. In short, A has a sessionID stored in its session, which I need to use to get the data source in B due to some crazy licensing rules imposed by the creators of A (this sessionID must be passed to each function in their base API for user authorization) .

Any ideas on why the functionality no longer works (assuming I copied the old environment correctly) or how could I get around it? Switching to SQL server for session state is not an option - I canโ€™t change anything about application A.

I was looking a bit for code A (as far as I dare with Reflector), and the variable that I am trying to extract from the session still exists and is being used.

Any thoughts would be great!

+6
session legacy-code iis-6
source share
1 answer

Since they are two separate applications, they (obviously) have two different session areas. You can have a session in one, but not on the other, and a session in can expire before a session in B, forcing A to create a new session, while B is still using the old one. There, nothing connects A with B or vice versa, so logically there is no way that they could share objects, since there is no significant correlation between them.

In short, you cannot (easily) directly share a session with session data between two different applications. A common solution to this problem is to pass a common identifier between two applications using querystring or cookie (if they are in the same domain), and both use this identifier to return to a common record in the database that they can access. From this point on, information can be transmitted through the database.

+3
source share

All Articles