Tuesday, March 8, 2011

How to use Session variable in Asp.net web service

In order to use Session variable in asp.net web service you need to add
EnableSession=true attribute in web method definition.

[WebMethod(EnableSession=true)]
public void HelloUser()
{
return "Hello " + Convert.ToString(Session["LoggedInUser"]);
}

1 comment:

  1. it will fetch session from site from where we are calling web service ?

    ReplyDelete