views:

1097

answers:

4

i would like a working example, that uses a asp.net session state server, to share a session variable between two .net 2.0 web applications both running on the same domain, just in different folders ( same parent folder)

directory structure:

parent site: [localhost/testSite] web app 1 site: [localhost/testSite/webapp1] web app 2 site: [localhost/testSite/webapp2]

web app 1 site sets a Session variable ("myVarImSetting") web app 2 site gets a Session variable ("myVarImSetting")

after the project is compiled, run web app 1 first, to set the variable, then while its still open, browse to web app 2 page, and display the value stored in Session(myVarImSetting")

this should work, there should be a way of doing this, im told there is, but no one has offered any proof, and a working demo for .net 2.0 framework, using asp.net state server.

+3  A: 

Here is an article with code sample.

Dave Swersky
i said we dont want to use an sql server...
Greg R
i guess this is the only solution for what i wanted to do, i will have to look for another way to combine the projects instead.
Greg R
A: 

Can you use Application variables for this?

Application("myVarImSetting") = 5;
int mySetting = (int)Application("myVarImSetting");
Sean
uh i dont know? ive never used application variables before.. could this allow the passing of data between both applications? and can we just then null them out when the session dies?
Greg R
i think this would be bad from the bit of reading i have done.. this will allow the value to be accessed by all users, i want to pass user specific data back and forth between two different web applications, thats why i want the session instead... unless you think we can use it the way we want to?.
Greg R
A: 

uh i have just come across this article, if this is correct, then i am at a loss, if this is false, can anyone prove it?

http://forums.asp.net/p/931361/1093750.aspx#1093750

The Session State server is not running for that purpose. It is designed to provide a separation of state from the worker process, and can thus be used for things like web gardens/farms and for some degree (albeit lightweight) of fault tolerance.

Each application receives its own store in the state server, and state cannot be shared between applications this way. The only thing wrong with the code is that you are attempting to use the state server for something that it's not designed to do.

If you want to share data between applications, I'd recommend that you use a database.

thanks.

Greg R
That's correct, the State Service is not for shared state, it's to separate the maintenance of state from the worker process. What you want is a product like ScaleOut StateServer. Google for more info.
Dave Swersky
i ended up reverting back to inproc.. the state server is doing nothing for me.
Greg R
A: 

thats helpful