Some days back I was writing a few web services. I have coded web services many times, but never required to use Session State before. This time I required to check a few session variables before returning the correct data from the web service. I tried using the HttpSession like in a normal web page but got an error. After a little search found the right way to use HttpSession in webmethods. The simple trick is to enable the Session State before using it directly. This can be done by using the following attribute
[WebMethod(EnableSession = true)] // C#
<WebMethod(EnableSession:=true)> // VB .Net
Once you specify these lines over your web method you can use the session object naturally.