Application Setup
- I am using HttpClient to make mulitple Async POST requests to a REST service from a Windows Forms Application.
- Meanwhile the response is fetched from the REST service the application shows a Processing... window with a Cancel button.
- Now, when the user presses the Cancel button I am using HttpClient.CancelPendingRequests to cancel the ongoing requests.
- Using HttpClient.CancelPendingRequests throws TaskCanceledException on the PostAsync mthod call.
Query
- Is there any way I detect that the TaskCanceledException was thrown due the calling of HttpClient.CancelPendingRequests and not due to any other reason (like timeout)
- Is there any other approach to achieve similar cancellation functionality?
Thanks