views:

13

answers:

0

How can I access the Session State created from a Client(Website) to my Web Service Proxy site?

Services Interface Proxy

public class SessionService : System.Web.Services.WebService
{

 [WebMethod(EnableSession=true)]
 public string GetSession(string key)
 {
     return HttpContext.Current.Session[key].ToString();
 }
}

Website hosting the service

protected void Page_Load(object sender, EventArgs e)
{
    Session.Add("User", "Anonymous User");

    SessionServiceClient serv = new SessionServiceClient();

    Response.Write(serv.GetSession("User")); //throws SoapException: Object not set to an instance error.

 }

thanks in advance.. ^^