Set timeout for webClient.DownloadFile()

Viewed 109978

I'm using webClient.DownloadFile() to download a file can I set a timeout for this so that it won't take so long if it can't access the file?

4 Answers

Try WebClient.DownloadFileAsync(). You can call CancelAsync() by timer with your own timeout.

Related