views:

102

answers:

2

Hi,

I would like to know the method of passing session variables/values to a subdomain from the main website.

For eg : Upon user login, I would like to set some session variables and redirect the page to a subdomain URL.

How can this be done?

fyi... I have setup two websites in IIS. One is localhost and the other is subdomain.localhost

So, If I want to retrieve the session values in subdomain.localhost (which points to a specific folder in the app), how should I go about it?

Thanks

+2  A: 

You could try setting up StateServer or SQLServer for your sessions. That you can load the session from any application bases on the session ID.

Glennular
Thanks. On further googling, I decided to try out the former.Added a line in web.config <sessionState mode="StateServer" stateConnectionString="tcpip=localhost:42424" cookieless="false" />Had set a session object in localhost domain in default.aspx codebehind. But when am trying to retrieve the value that has been set in subdomain localhost, I get the below errorObject reference not set to an instance of an objectBelieve the session object is null in subdomain URL. But not sure why.Any idea on what might be going wrong here? Thanks!
A: 

Optionally, you could forgo session and instead use cookies. Then you can restrict the cookie path to the whole domain thereby sharing the information without having the need to use an out of process session scheme like stateserver or storing the session info in sql server.

Chris Lively