Topaz Filer: if you use e-mail for business, we can save you money and decrease your risk.
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...
 
Auto-following on Twitter
Ubuntu and XP on one “desktop”
 
    
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...
 
Outlook interop - stopping user properties appearing on Outlook message print
Seriously, why is “cut and paste” majorly newsworthy???
 
    
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...
 
Email Archiving and Email Filing - what’s the difference?
Web-based task/todo list management
 
    
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...
 
Open source windows
The Law Society’s guidelines on e-mail management
 
    
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...
 
Google Docs… no.
Twitter Elite
 
    
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...
 
Auto-following on Twitter
Ubuntu and XP on one “desktop”
 
 
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.
Recession Busting Bespoke Software
Get through the recession by investing in bespoke software to decrease costs and create commercial opportunities.
Other DN247 Network Sites
.NET 247
SQL Server Wins
Old Skool Developer
 
Copyright © AMX Software Ltd 2008-2009. Portions copyright © Matthew Baxter-Reynolds 2001-2009. All rights reserved.
Contact Us - Terms of Use - Privacy Policy - .NET 247 is a member of the DN247 Network - 4.0.30129.1734