Silverlight Student
Silverlight Student

Reputation: 4118

Cancelling call to web-service from application

I have a winform app that has two buttons GetData and Close. On GetData I retrieve some data from a web-service whereas Close just closes the dialog. I am calling the web-service on a separate thread. This thread is class instance variable. If getting data from web-service is taking too long and user click on close, I want to cancel that call to web-service and just close the dialog.

What is the best way of cancelling that call to web-service, by just calling abort on thread instance? Any other idea/best practices are welcome too.

Upvotes: 2

Views: 607

Answers (1)

PraveenVenu
PraveenVenu

Reputation: 8337

You can not cancel it. Once the webservice call is placed then it will get executed even if the calling thread is aborted.

Upvotes: 1

Related Questions