Wednesday, 28 August 2013

How to handle timeouts with WebClient.UploadDataAsync method?

How to handle timeouts with WebClient.UploadDataAsync method?

Using the UploadDataAsync method of the WebClient class, how can I handle
timeouts erros properly?
I've little googled about this issue and saw that you can derive from
WebClient class and override the GetWebRequest method in order to sets
your prefered timeout period in the WebRequest.Timeout property, but on
the other hand, I saw that with Async methods like I'm using right
now(UploadDataAsync), this property is irrelevant and I should use the
WebRequest.Abort() method with custom code to handle timeouts events.
Anyone have encountered with such an issue in the past or have any idea
about how to solve it?

No comments:

Post a Comment