Same Session for 2 different Applications

  • Thread starter Thread starter Jazper
  • Start date Start date
J

Jazper

hi

i'd like to be able to access the same objects in the session but by
different applications on the same webserver.

example:
C#-WebApp creates Session-Object "xxx" and redirect to a VB-WebApp which
should be able to read this Session-Object "xxx".
how can i do this?

thanx for ever hint.
regards, jazper
 
Hi Jazper,
You can pass data (for example session state, session id or Session-Object
"xxx") between two application using "Application" property:
App A write:
Application["someInt"] = iSomeInt;
App B read:
int iSomeInt = (int)Application["someInt"];

To pass data between two apps (thread) within one session use "Session"
property (as above).
To to make these methods thread - safe, use lock() or if you store a
collection, you can use, ICollection.Synchronized(ICollection) method
Regards,
MK
 
hi Maciej

thank you but it did not work with Application! neither with Session!
App A can write AND read the "someInt" but App B is getting null everytime!

App A write:
Application["someInt"] = iSomeInt;

App A read:
int iSomeInt = (int)Application["someInt"]; //everything OK

App B read:
int iSomeInt = (int)Application["someInt"]; // !! Application["someInt"]
returns null !!

does i have to set some property or capture session manually somehow?

regards, jazper




Maciej Kolosinski said:
Hi Jazper,
You can pass data (for example session state, session id or Session-Object
"xxx") between two application using "Application" property:
App A write:
Application["someInt"] = iSomeInt;
App B read:
int iSomeInt = (int)Application["someInt"];

To pass data between two apps (thread) within one session use "Session"
property (as above).
To to make these methods thread - safe, use lock() or if you store a
collection, you can use, ICollection.Synchronized(ICollection) method
Regards,
MK

Jazper said:
hi

i'd like to be able to access the same objects in the session but by
different applications on the same webserver.

example:
C#-WebApp creates Session-Object "xxx" and redirect to a VB-WebApp which
should be able to read this Session-Object "xxx".
how can i do this?

thanx for ever hint.
regards, jazper
 
now i found my failure!
both apps has to be in the same directory!



Jazper said:
hi Maciej

thank you but it did not work with Application! neither with Session!
App A can write AND read the "someInt" but App B is getting null everytime!

App A write:
Application["someInt"] = iSomeInt;

App A read:
int iSomeInt = (int)Application["someInt"]; //everything OK

App B read:
int iSomeInt = (int)Application["someInt"]; // !! Application["someInt"]
returns null !!

does i have to set some property or capture session manually somehow?

regards, jazper




Maciej Kolosinski said:
Hi Jazper,
You can pass data (for example session state, session id or Session-Object
"xxx") between two application using "Application" property:
App A write:
Application["someInt"] = iSomeInt;
App B read:
int iSomeInt = (int)Application["someInt"];

To pass data between two apps (thread) within one session use "Session"
property (as above).
To to make these methods thread - safe, use lock() or if you store a
collection, you can use, ICollection.Synchronized(ICollection) method
Regards,
MK

Jazper said:
hi

i'd like to be able to access the same objects in the session but by
different applications on the same webserver.

example:
C#-WebApp creates Session-Object "xxx" and redirect to a VB-WebApp which
should be able to read this Session-Object "xxx".
how can i do this?

thanx for ever hint.
regards, jazper
 
Back
Top