I think this would depend on the "brand" of state server being used. Im sure it's possible with some. Sessions are meant to be treated as domain-specific so in normal circumstances it isn't possible without creating some kind of work-around manually.
One solution might be to force user's to login on only one of the applications (such as the "xyz" example you provided above).
If an unauthenticated user navigates to the "abc" app, redirect to the "xyz" app's login. If a user is authenticated in app "xyz" and they navigate to app "abc", pass along a heavily protected variable containing the an identifier for the user, and upon
landing at "abc" app, perform a quick validation of the variable that has been passed to make sure it's valid, then use it to perform an automatic login for the 2nd app.
Sounds confusing maybe but it would be pretty simple to set up.
A simpler solution would be to use a shared id system like OpenAuth or WindowsLive but well, not very secure for something dealing in finances and stock options lol.
Would the soltion I provided above be feasable for you?
When the going get's tough, the tough outsource and take a vacation... lol I wish :(
Just a followup for ths thread since I noticed it is still unanswered. Short answer is no, this is not possible with default asp.net state service.
Session state can be shared in a web-farm environment when configuration is handled properly because each server is still treated as the same virtual path.
However, to do this in the scenario described by the original poster's question, it will not work with asp.net's default state service providers.
The reason is because, as with membership providers, the session provider takes a application name property aswell. However, this value does not get specified in a configuration section like other providers. Instead, it takes the virtual path of the application's
root. Since you have 2 different applications in 2 different virtual directories, the path provided will be different for both, therefore, making sessions unsharable.
Hope this clears up questions for the people in this thread.
When the going get's tough, the tough outsource and take a vacation... lol I wish :(
As http://msdn.microsoft.com/en-us/library/ms178586.aspx stated,
StateServer makes session state available to multiple Web servers in a Web farm. Do you think it is only accessible among servers in the web farm, but not sharing sessions among them (even make some tricky means to do so)?
I have search for this solution over two weeks, and still can't get the result.
For SQLServer, I have done the following two steps:
1. Set the application name for sqlConnectionString. in Web.Config for two web sites project.
2. Modified SP (TempGetAppID) in DB (ASPState), to get the same application name (app).
DECLARE @connStrAppName nvarchar(50) SET @connStrAppName = APP_NAME() IF (@connStrAppName <> '.NET SQLClient Data Provider') SET @appName = @connStrAppName
magicmike201...
Contributor
2021 Points
481 Posts
Re: Share sessions between asp.net web applications using State Server
Mar 06, 2012 06:15 AM|LINK
I think this would depend on the "brand" of state server being used. Im sure it's possible with some. Sessions are meant to be treated as domain-specific so in normal circumstances it isn't possible without creating some kind of work-around manually.
One solution might be to force user's to login on only one of the applications (such as the "xyz" example you provided above).
If an unauthenticated user navigates to the "abc" app, redirect to the "xyz" app's login. If a user is authenticated in app "xyz" and they navigate to app "abc", pass along a heavily protected variable containing the an identifier for the user, and upon landing at "abc" app, perform a quick validation of the variable that has been passed to make sure it's valid, then use it to perform an automatic login for the 2nd app.
Sounds confusing maybe but it would be pretty simple to set up.
A simpler solution would be to use a shared id system like OpenAuth or WindowsLive but well, not very secure for something dealing in finances and stock options lol.
Would the soltion I provided above be feasable for you?
Bilawal121
Member
16 Points
10 Posts
Re: Share sessions between asp.net web applications using State Server
Mar 13, 2012 08:06 AM|LINK
Hi, i have similar problem have you got solution,if yes then please inform me , i need that solution
thanks in advance
apphkbruce
Member
6 Points
3 Posts
Re: Share sessions between asp.net web applications using State Server
Aug 20, 2012 05:29 AM|LINK
Hi,
I also have the exact problem like yours.
I also can't find the way on how to set application name (or application path) for two sites to share sessions with using StateServer mode.
For link that Qi Wu - MSFT provided, http://support.microsoft.com/kb/325056, I failed to test it.
Have you got the way to set it or any other solutions of the problem?
magicmike201...
Contributor
2021 Points
481 Posts
Re: Share sessions between asp.net web applications using State Server
Aug 21, 2012 12:51 AM|LINK
Just a followup for ths thread since I noticed it is still unanswered. Short answer is no, this is not possible with default asp.net state service.
Session state can be shared in a web-farm environment when configuration is handled properly because each server is still treated as the same virtual path.
However, to do this in the scenario described by the original poster's question, it will not work with asp.net's default state service providers.
The reason is because, as with membership providers, the session provider takes a application name property aswell. However, this value does not get specified in a configuration section like other providers. Instead, it takes the virtual path of the application's root. Since you have 2 different applications in 2 different virtual directories, the path provided will be different for both, therefore, making sessions unsharable.
Hope this clears up questions for the people in this thread.
apphkbruce
Member
6 Points
3 Posts
Re: Share sessions between asp.net web applications using State Server
Aug 21, 2012 01:45 AM|LINK
Thanks magicmike2011's comment!
As http://msdn.microsoft.com/en-us/library/ms178586.aspx stated, StateServer makes session state available to multiple Web servers in a Web farm. Do you think it is only accessible among servers in the web farm, but not sharing sessions among them (even make some tricky means to do so)?
I have search for this solution over two weeks, and still can't get the result.
For SQLServer, I have done the following two steps:
1. Set the application name for sqlConnectionString. in Web.Config for two web sites project.
<sessionState mode="SQLServer"
sqlConnectionString="data source=localhost;user id=u;password=p;application name=app"
cookieless="false"
timeout="20"/>
2. Modified SP (TempGetAppID) in DB (ASPState), to get the same application name (app).
DECLARE @connStrAppName nvarchar(50)
SET @connStrAppName = APP_NAME()
IF (@connStrAppName <> '.NET SQLClient Data Provider')
SET @appName = @connStrAppName
Reference: http://forums.asp.net/t/1814547.aspx/1
Result:
It worked to share session ID with the same application name.
However, my supervisor wants to use StateServer to share session, instead of using SQLServer.
But here also comes a question for SQLServer:
Q: The record to be inserted into ASPStateTempApplications was sometimes missing. Does anyone know why and how to solve it?
Thanks!
apphkbruce
Member
6 Points
3 Posts
Re: Share sessions between asp.net web applications using State Server
Sep 14, 2012 04:18 AM|LINK
In ASPState database, ASPStateTempApplications table has AppName field.
When two applications login, there are two newly created rows.
For AppName field, the value is Meta path for the web application seperately.
For example:
Web Application (1): /lm/w3svc/1/root/app1
Web Application (2): /lm/w3svc/1/root/app2
Does anyone know how to change the meta path for two applications to be the same, so that the session can be shared across two web applications?