Multimobile Development: Building Applications for any Smartphone
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

Reply to this message...
Vote that this is a GOOD answer...
 
Really good experience at the Apple Store
MonoDroid – looking *awesome*
 
    
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]

Reply to this message...
Vote that this is a GOOD answer...
 
First volume of Multimobile Development nearly ready to go to press
A mention on Developing for the iPhone and Android: The pros and cons
 
    
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]

Reply to this message...
Vote that this is a GOOD answer...
 
 
    
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]

Reply to this message...
Vote that this is a GOOD answer...
 
First chapters of Multimobile Development book now available on Apress Alpha program
iPad
 
    
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]

Reply to this message...
Vote that this is a GOOD answer...
 
New book project – Multimobile Development: Building Applications for any Smartphone
Dive into HTML5
 
    
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]

Reply to this message...
Vote that this is a GOOD answer...
 
 
    
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]

Reply to this message...
Vote that this is a GOOD answer...
 
Steve Jobs’ thoughtful/thought provoking Thoughts on Flash…
Handy list of countries in CSV format
 
    
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]

Reply to this message...
Vote that this is a GOOD answer...
 
Really good experience at the Apple Store
MonoDroid – looking *awesome*
 
 
System.DateTime
System.Runtime.Remoting.Messaging.CallContext
System.Runtime.Remoting.Services.RemotingService
System.Security.Cryptography.MD5
System.Web.Services.WebService




Ad
BootFX
Reliable and powerful .NET application framework.
iOS, Android and Windows Phone Development Training and Consultancy
Hosted by RackSRV Communications
 
Multimobile Development: Building Applications for any Smartphone
Copyright © AMX Software Ltd 2008-2010. Portions copyright © Matthew Baxter-Reynolds 2001-2010. All rights reserved.
Contact Us - Terms of Use - Privacy Policy - 4.0.30129.1734