Tales from the Evil Empire

Bertrand Le Roy's blog

News


Bertrand Le Roy


Add to Technorati Favorites Tales from the Evil Empire - Blogged

Blogs I read

My other stuff

Archives

Session sharing between ASP and ASP.NET

The question comes back every so often, so I thought I'd post about it.
 
Almost all existing solutions are intrusive and need to modify the code of the ASP application, the ASP.NET application or both. All solutions incur a performance cost as the data has to be marshaled between the COM world of ASP and the .NET world of ASP.NET.
 
First, there’s a solution in MSDN: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/converttoaspnet.asp but it necessitates modifications on both sides and needs a database, which could degrade the application’s performance.
 
There are also a few commercial products, all in the $200 to $300 range:
 
http://www.consonica.com/solutions/statestitch/ which just requires one include on top of each ASP page that uses the session. One drawback is that it doesn’t support COM objects in the session, except for Dictionary.
 
http://www.sessionbridge.com/ which requires more code changes to all places where the ASP session is used.
 
And then, there is my own approach, which is the only one that I know of that requires no source code change anywhere (except a few very particular cases), but it’s just a proof of concept, nothing I would use in a production environment (we have no performance data):
http://www.dotnetguru.org/articles/us/ASP2ASPNET/ASP2ASPNET.html
 
And a very similar attempt which may scale better:
http://weblogs.asp.net/mtrova/archive/2004/04/15/113899.aspx?Pending=true
 
My own approach is shared source, so anyone is free to improve on it.

Comments

TrackBack said:

# October 21, 2004 8:09 PM

TrackBack said:

# October 21, 2004 9:34 PM

Christophe Lauer, Blog Edition said:

La question du partage des variables de sessions revient assez souvent, pas plus tard qu'hier pendant...

# July 19, 2006 5:15 PM

NITMAL said:

Please let me know the status of your POC, has it been tested on production by someone now...or some better way to do the ASP and ASP.Net session sharing...bcoz i need to implement it in my new migration project. We were thinking of using the database approach given on msdn...but looks like u have a better idea...Please suggest
# November 2, 2006 12:24 AM

Bertrand Le Roy said:

Nitmal: not that I know of so I'd say it's relatively risky. It totally depends on the type of project. On the bright side, the source is totally free to use and modify. If I can be of assistance, you can e-mail me through the contact form.

# November 2, 2006 3:37 PM

NITMAL said:

Thanks for your inputs...the project is a financial domain project...which is currently in asp3.0 and little bit in asp.net1.1...We are in the process of migrating it to .net 2.0...However we plan to do it in the incremental way rather than the Big bang approach...So we were exploring the best ways to use session in .net in terms of performance,scalability and failover..but also keeping in mind the coexistence of asp and aspx..We have a few options on which we want to expolre before doing POC's on the best two...A few options we have are... a)The msdn suggested way using database as an intermediate session store...We can also use this Db as out-proc session store..for our web farm.. b) Third party products...Like StateStich and AspBridge..for asp/aspx session shsring.. c) Your POC way.. However performance and security are some major things we need to keep in mind before picking our solutions...as the application is a heavy traffic,high security site... Please provide us some inputs which can help us in moving forward... Thanks Again for all ur help Nitmal
# November 2, 2006 11:07 PM

Bertrand Le Roy said:

Looks mission critical from your description...

Another thing to consider is the amount of data you store in session and how often you query it.

Contact me through the contact form of this blog, we can talk about the different options that you have.

# November 3, 2006 3:31 PM

Abhi said:

have few queries on it: 1)To use this utility do I have to write any additional code in my ASP or ASP.NET page? 2)Is this utility shipped with framework 1.0 and above version? 3)Where this utility should be deployed to make it useful in web farm scenario? 4)I have an application which has few ASP, few ASP.NET and few JSP pages. So will this utility work for all of them in case to share session variables? Specifically JSP. Apart from this can you suggest me some links/books which can give more details on this and samples where it is implemented?
# November 13, 2006 8:16 AM

Bertrand Le Roy said:

Abhi:

1. No.

2. No, it's entirely unsupported and experimental.

3. On each server, which should be set up to share the ASP.NET session. The ASP part will pick it up, which is a nice bonus.

4. No luck for JSP. I don't know of a session sharing solution between JSP and ASP/ASP.NET.

# November 13, 2006 8:15 PM