Write a WebMethod and set the Enable as True
Note: Default is false
public double YourMethod()
//TODO: Method implementation
In order to store session state in the Asp.Net HttpSessionState object, the XML web service must inherit from WebService and a WebMethod attributes applied to the XML web service method, setting the EnableSession property to true.
An XML Web service client is uniquely identified by an HTTP cookie returned by an XML Web service. In order for an XML Web service to maintain session state for a client, the client must persist the cookie. Clients can receive the HTTP cookie by creating a new instance of CookieContainer and assigning that to the CookieContainer property of the proxy class before calling the XML Web service method. If you need to maintain session state beyond when the proxy class instance goes out of scope, the client must persist the HTTP cookie between calls to the XML Web service. For instance, a Web Forms client can persist the HTTP cookie by saving the CookieContainer in its own session state. Because not all XML Web services use session state and thus clients are not always required to use the CookieContainer property of a client proxy, the documentation for the XML Web service should state whether session state is used.