views:

376

answers:

2

Hi,

In an asp.net application, i would like to use a webservice to return the username associated with the session id passed as a parameter. We're currently using InProc session store.

Is it possible to do this ?

Edit: what i'm trying to do is get information about another session than the current one. I'm not trying to get the SessionID, i've already got it. I'm trying to get the user information associated with a given SessionID.

Thanks,

Mathieu G.

A: 

You could possibly create a "fake"cookie with the session ID and make a request to your web service using it, so that the web service was fooled into thinking you were part of the session, enabling you to read any info from it. Sounds like quite the hack, though :)

Fredrik Kalseth
Indeed, it sounds like a hack, and I think ASP.NET has protections against this kind of things... I'll try it as last resort !
Mathieu Garstecki
A: 

Something like:

HttpSessionState ss = HttpContext.Current.Session;
HttpContext.Current.Response.Write(ss.SessionID);

That will get the current sessionID.

The.Anti.9