views:

247

answers:

2

HI,

We have two applications to be hosted on two different servers. The applications will be built in .NET3.5 and hosted using IIS. We want to share the session variables between the application which will be on different servers. Is there some way through which we can achieve this.

A: 

The default way of storing session data on the server is InProc, which stores the session data in the memory of each server.

To share the sessions between servers you need to use either of the modes StateServer, SQLServer or Custom instead.

Read more on Session state modes

Guffa
I know about InProc, State Server and sql Server modes but the question is how..? I was trying State Server but I was not successful, If some Information on how to Implement the modes is provided it will be more helpful
Rishabh Ohri
There is a lot of information on the page that I linked to. To use StateServer you have to make sure that the service is started on the server that you want to use for storage and that you can reach the server from the web servers through the port. There is an example on how to configure web.config to use StateServer on the page that I linked to.
Guffa
+1  A: 

If these are two different applications then you will not be able to share session data between them. StateServer is intended to share session between the same application hosted in a web farm although there are some hacks that might allow you to do this which involve tweaking with the application name. You will need to implement some custom mechanism to synchronize sessions between those applications.

Darin Dimitrov