I need to be able to cancel asynchronous calls made in my web service. One of my solutions is to use my flow control and use synchronous methods from the SOAP client. This works great, and it requires finer flow control.
If I used any of these two templates provided when adding a link to a web service, say:
var Client = new ASL_WS.SvcSoapClient() IAsyncResult result = Client.BeginAuthenticateUser(Email, Password, new AsyncCallback(AuthCompleted));
or
var Client = new ASL_WS.SvcSoapClient() Client.AuthenticateUserCompleted += AuthCompleted; Client.AuthenticateUserAsync(Email, Passsword);
Does any of these two templates give me a way to cancel the request? One use case might be: the user logs in, but wants to cancel it before the authentication session ends.
Of course, I could implement this differently by changing the asyncState passed to these calls and setting it to disable the UI update, but that's not what I'm looking for.
Can I just cancel all outstanding operations. Does Client.Abort () cancel such operations. What if there are many asynchronous requests, all canceled? Are there other API methods that can do this?
source share