|
| Passing a session id to the server |
|
|
|
|
| Messages |
|
Related Types |
This message was discovered on microsoft.public.dotnet.framework.remoting.
| Christian Nagel |
With a remoting service running in IIS I can access the session state, user, application, etc using the RemotingService class.
What is the best way to pass a session from a console client to the server? I assume this must be done with the HTTP header, but what is the best way to do this?
Many thanks, Christian
|
|
|
| |
|
| |
| |
| Gregory Nickonov |
I think that the best solution is to use CallContext attributes. I use the following technique:
1) I have class Session with all information that I need during session processing 2) I also have class SessionID which consists of two GUIDs: session id and hash, which is computed as MD5 hash of session id with some secret value. SessionID is context-bound attribute which is returned from Login procedure of my remote object. 3) Client must call Login method, obtain SessinID, put it into CallContext and continue with other remote methods. 4) Every remote method implementation on server picks up SessionID from CallContext, checks session id with hash and then extracts Session object from Hashtable using Session id field as a key.
You can also create session expiration by setting DateTime.Now to some field of session each time session accessed. Then you create a Timer-called procedure which will remove sessions that was not accessed for 30 minutes, for example.
Hope that helps, Regards, Gregory.
"Christian Nagel" <Click here to reveal e-mail address> wrote in message news:uHj6VG#NBHA.1312@tkmsftngp05... > With a remoting service running in IIS I can access the session state, user, [Original message clipped]
|
|
|
| |
|
| |
| |
| Christian Nagel |
Hello Gregory,
thanks for the information, but I have used this technique you described for remoting services that not necessarily run within IIS. This technique is independent of the hosting environment.
Instead I want to make use of the ASP.NET functionality. The RemotingService class already provides Session, Application, etc properties for the server. How can I fill these?
Many thanks, Christian
"Gregory Nickonov" <Click here to reveal e-mail address> wrote in message news:#Vy0TDEOBHA.1824@tkmsftngp05... [Original message clipped]
|
|
|
| |
|
|
| |
| |
| Gregory Nickonov |
Christian,
I don't think you can use those classes. I think they're provided by IIS/ASP.NET but not by "normal" remoting framework. But maybe I'm wrong...
Regards, Gregory.
"Christian Nagel" <Click here to reveal e-mail address> wrote in message news:#IMhYqEOBHA.2048@tkmsftngp05... [Original message clipped]
|
|
|
| |
|
| |
|
|
|
| |
| Christian Nagel |
Now I've successfully used the User and Application property of the RemoteService class in a .NET remoting server running in IIS, but the Session is null.
How can I enable the session for the remoting server? Session is enabled in the web.config file.
Many thanks, Christian
"Christian Nagel" <Click here to reveal e-mail address> wrote in message news:uHj6VG#NBHA.1312@tkmsftngp05... > With a remoting service running in IIS I can access the session state, user, [Original message clipped]
|
|
|
| |
|
| |
| |
| Gregory Nickonov |
Christian,
There is an attribute you can apply on method in webservice to enable it's participation in session. Maybe you can try it on normal remote object?
Regards, Gregory.
P.S. Can you let me know if it will work?
"Christian Nagel" <Click here to reveal e-mail address> wrote in message news:eC7MoDgOBHA.1792@tkmsftngp05... [Original message clipped]
|
|
|
| |
|
|
| |
|
| |
| Gregory Nickonov |
Christian,
There is an attribute you can apply on method in webservice to enable it's participation in session. Maybe you can try it on normal remote object?
Regards, Gregory.
P.S. Can you let me know if it will work?
"Christian Nagel" <Click here to reveal e-mail address> wrote in message news:eC7MoDgOBHA.1792@tkmsftngp05... [Original message clipped]
|
|
|
| |
|
| |
| |
| Christian Nagel |
Hi Gregory,
No, it doesn't work. [WebMethod(EnableSession=true)] just works for classes that are derived from WebService, it doesn't work for classes derived form RemotingService.
Regards, Christian
"Gregory Nickonov" <Click here to reveal e-mail address> wrote in message news:OaARKloOBHA.1560@tkmsftngp03... [Original message clipped]
|
|
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
BootFX
Reliable and powerful .NET application framework. |
|
|
|
|
|
|