Sharing session information across two web applications

Posted on 2008-10-06
Medium Priority
Last Modified: 2012-05-05
We have two ASP.net web applications AppA and AppB under the same domain, is it possible to preserve session information from App A to App B ?  Users from AppA are redirected to AppB with information (login and other crtitical data) being transfered by query string to AppB. Now is it possible to maintain reliable distinct session for each user being transfered between the two applications ?

I noticed some user information was being mixed up with the others, is a query string not a good solution for this purpose ?
Question by:byte1
  • 3
  • 2
LVL 20

Expert Comment

by:Obadiah Christopher
ID: 22656605
You could have a look @ storing the Session in a sql server d/b.

Author Comment

ID: 22656612
Yes, I am aware of that option, but would using the query string transfer method not create a unique session ?
LVL 20

Expert Comment

by:Obadiah Christopher
ID: 22656621
How are u sending the session information currently?

Response.Redirect("url"+SessionInfo) ?? something like this?
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.


Author Comment

ID: 22656644
yes, thats how i send information over to AppB.

What i am interested in knowing is under the same domain, is every call to AppB unique with a unique session id.
LVL 20

Expert Comment

by:Obadiah Christopher
ID: 22656702
If I'm not mistaken, if u r redirecting from appa to appb then the session id should remain the same
LVL 14

Accepted Solution

Ramuncikas earned 2000 total points
ID: 22656845

As a matter of fact each ASP.NET application has it's own session navigating from AppA to AppB will create a new session on AppB while session on AppA will be still active. Even if SessionIDs on both applications are the same Sessions as instances are two different objects and there is no straight forward way to share info between them. If you come back to AppA from AppB before session expires on AppA you will use the same session object.

Sql Session state management is way to go, but you have to keep in mind to major cons:
 - Sql Session state management is about 30% slower then standard InProc Session state management
 - If you want to use Sql Session state management all objects stored in Session have to be serializable. That means there is no problem to store int, string and even datatable into session. But there is a problem to store custom class becuse and it should implement ISerializable interface

I would suggest you two solutions:
1. Do the same as you do now just take ALL query string, encrypt it and pass encryption result as a query string. Safer but not safe enough.
2. Use database to store/retrieve data to be passed among two applications. This might be slower then query string but safer for sure. And this will be even faster then managing Session state in Sql because Sql Session state management will query database many more times then you storing retrieving data on cross-application navigation

If you use Forms authentication in both of your applications you could also implement Single Sign-on (SSO).
(there are many more articles, just ask google :) )
If additional info you want to have in both applications is user relevant then you could extend Users table and have that info stored/read from there.


Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
How to fix display issue, screen flickering issue when I plug in power cord to the machine. Before I start explaining the solution lets check out once the issue how it looks like after I connect the power cord. most of you also have faced this…
In the video, one can understand the process of resizing images in single or bulk. Kernel Bulk Image Resizer is an easy to use tool for resizing large number of images. One can add and resize multiple images with this tool in single go. The video sh…
Suggested Courses

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question