Hi,
I am trying to access web services from the windows forms.
In the web services iam trying to maintain the session by setting the attribute "EnableSession = true" of the Web Method. And then i tried to maintain sessions as Session["user"] = userName. When i tried to call the web service methods from the winForm, iam getting the following exception
"An unhandled exception of type 'System.InvalidOperationException' occurred in system.web.services.dll
Additional information: HttpContext is not available. This class can only be used in the context of an ASP.NET request."
Here the HttpContect.current.session object is storing null (not set an object reference). My doubt is if the web services are accessed through winForms, does the httpcontext exist? Why it is giving that error. The same code works fine for web forms.
Here is the code of the webservice:
[WebMethod (EnableSession =
{
Session["userName"] = userName;
}
My client code:
string
MessageBox.Show(sss);
MessageBox.Show(ss);
Any kind of help appreciated.--Charani