Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Webclient downloaddata() taking too much time and giving time out exception when we use it in foreach loop


What I have tried:

<pre>   WebClient web = new WebClient();

byt = web.DownloadData(new Uri(photopath));
Posted
Updated 25-Apr-17 22:53pm
v2

1 solution

This isn't a question we can answer: it's down to you and the site you are accessing.
We don't know how busy the site is, how much data is being transferred, how long it takes. We don't know what the site does with repeated requests: some may deliberately delay responses to mitigate possible DDOS attacks.

So start by making notes on the URL's you are requesting, and try accessing them manually via a browser. How fast are they being served? How much data is being transferred? What happens if you start several of them in quick succession? Does anything change?

It may be that you need to extend timeouts, it may be that you need to slow the frequency at which you access the site - we can't tell. And possibly, contact the site admin and see what he says.

So start by gathering information - we can't do that for you!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900