views:

447

answers:

3

I have a web app built on Java Servlet technology. I am thinking of switching to a new framework, possibly switching over to a .NET stack with C# and ASP MVC. I don't want to take the current app down while I develop the new one. The goal is to have the old system run and just develop new modules in a new architecture.

If I stay with a Java stack I think it is simply a matter of servlet mapping. However, If I switch to a .NET stack I will have to transfer sessions between the two systems. Is this doable in an easy way? Would I have to use something like SOAP?

Does anyone have any experience doing something like this?

Thanks

+2  A: 

Are they using the same DB? Just store session record information in a DB table record and pass the id of the record between the two systems.

Spencer Ruport
+2  A: 

No SOAP. Its easy:

1) make sure your Java web app is using a client (browser) based mechanism for tracking sessions. (Cookies, url encoding, etc.)

2) If you are putting complex java objects in your current sessions, make the necessary changes so that it is reduced to (effectively) a key/value dictionary.

3) Setup an external system (a DB for example) to store the key/value session data based on the session id from (1)

4) You will no longer use Servlet session mechanism. Instead you will need to write the basic session manager that returns a Map for a given session id.

-- on the .NET / Python / Woof side

5) You are still identifying sessions using the same container invariant mechanism as (1)

6) You will need to duplicate session manager (4) for your .NET container. Did you choose an RDBMs for (3)? Then this is nothing more than a query to that same database using the same session key

7) you are now serving different pages for the same app using 2 different containers.

+1  A: 

I think the best way would be to implement custom session providers on both systems, in order to store session data in a common database. This is possible in .NET, and I assume it is also possible in Java...

You should have a look at this page, which explains how to implement a custom session state store provider in .NET : http://msdn.microsoft.com/en-us/library/ms178587.aspx There is a sample implementation in VB.NET (see the link at the bottom of the page)

Thomas Levesque