I am trying to write a web service that returns session variables. The application that calls this web service has access to the the Session ID of the current session. 

I tried doing this by creating a "ASPNet\_SessionID" cookie and then attaching setting it as the cookie container of a proxy class to the web service but that does not work. I did this like so,

```
 protected void CallService(string sessionID)
    {
        localhost.AuthService auths = new localhost.AuthService(); //Service Proxy class
        System.Net.CookieContainer cookieJar = new System.Net.CookieContainer();

        System.Net.Cookie newCookie = new System.Net.Cookie("ASPNet_SessionID", sessionID);
        newCookie.Domain = "http://localhost";
        cookieJar.Add(newCookie);
        auths.CookieContainer = cookieJar;

        string SessionData = auths.GetSessionData();

```

The GetSessionData web method simply returns the Session data like so:

```
[WebMethod(EnableSession=true)]
public string GetSessionData(string sessionID) {return ((string)Session["user"]);}

```

Should this approach work, or am I doing something completely wrong?

UPD:This link actually solved my problem - I was able to access all the sessions InProc and was able to select the correct one by ID:

<http://weblogs.asp.net/imranbaloch/archive/2010/04/05/reading-all-users-session.aspx>