I have a asp.net web-service which I use from my ASP.NET website. I can call it from raw Javascript or jQuery to post/get data. The web-service is enabled with session so that only authorized users can access data.
[WebMethod(EnableSession = true)]
public WS_ServiceResponse SetAccountName(string account, string name)
{
WS_ServiceResponse osr = new WS_ServiceResponse();
WS_ServiceResponse sessionCheck = CheckSession(Session);
if (sessionCheck.result == WS_ServiceResponseResult.fail)
return sessionCheck;
osr.result = WS_ServiceResponseResult.success;
osr.data = "";
bool success = AccountController.SetAccountInfo(account, name);
if (success)
{
osr.result = WS_ResponseResult.fail;
}
return osr;
}
Now I have to create a desktop client to consume the service. I can add ServiceReference to do that. But How do I maintain session with that service? I am getting the result=fail when calling the webservice. Can anyone tell how to manage session in webservice reference in Windows Form Application.