c# - Calling WebService using Service Reference and Maintain Session -
I have an asp.net web service that I use from my asp.net website. To get the post / data, I can call it with raw javascript or jQuery. Web service is enabled with a session so that only authorized users can access the data.
[WebMethod (EnableSession = true)) Public WS_ServiceResponse SetAccountName (string account, string name) {WS_ServiceResponse osr = new WS_ServiceResponse (); WS_ServiceResponse sessionCheck = test session (session); Check the return session if (sessionCheck.result == WS_ServiceResponseResult.fail); Osr.result = WS_ServiceResponseResult.success; Osr.data = ""; Boole Success = AccountController. SetQquintInfo (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 it, but how will I maintain the session with that service? When I call webservice, the result is failing = Anyone can tell how to manage sessions in the webservice context in the Windows Forms application.
You should use one. Check out the post, it shows an example to add web service references to your WinForms / WPF project, post is useful.
Comments
Post a Comment