views:

351

answers:

2

I want to pass session from one application to other. Like what gmail and orkut is doing, i want to do that. Can anyone have some idea about how to do it?

Can it be possible without using any DB.

+1  A: 

Assuming you want to control the entire pipeline - to accomplish this you need a centralized state server of some kind, which both sites can communicate with on the backend. For many smaller applications the database itself is used as a state server, but that is just one implementation of many. There are dedicated state server products, some free and some paid.

Even if both of your applications are on the same server, it's not possible with out-of-the-box ASP.NET functionality to share session directly because in-memory session is in process. However, running either of the two products listed above on the same physical machine as both your applications, and pointing both applications to that state server, will get you nearly there - it will be the same memory footprint as if they truly shared session, and the performance is extremely good (interprocess communication is blisteringly fast compared to network I/O).

Here is a more detailed description of the mechanics of a common authentication scheme between two or more sites.

Rex M
A: 

What language are you using? If you are using ASP.NET on IIS, which I'd assume by your tags, you can do it using the machineKey attribute of <system.web> in the web.config file. It would look similar to this:

<system.web>
 <machineKey validationKey="(here)" decryptionKey="(here)" validation="SHA1" />
</system.web>

Then, you can use the enableCrossAppRedirects="true" attribute on <forms> authentication type if you'd like the authentication keys to be passed between apps.

Also, if you'd like to generate a machineKey, you can use Scott Forsyth's tool at http://www.orcsweb.com/articles/aspnetmachinekey.aspx

Finally, as the first answer was posted, you can implement the ASP.NET state server for better control of the application's state. The ASP.NET team will be releasing Velocity soon which handles distributed caching. There are also third party tools for both.

Jason N. Gaylord