Reputation: 5536
I have a strange problem when usinng WebClient.DownloadString(). It is very very slow and sometimes does not work but if I try browsing using IE9/Chrome to the website everything works fine.
Here is the code:
var req = new WebClient();
req.Encoding = Encoding.UTF8;
string result = string.Empty;
result = req.DownloadString(someURL);
Any ideas?
Upvotes: 0
Views: 6601
Reputation: 63065
Try Setting WebClient.Proxy
to GlobalProxySelection.GetEmptyWebProxy
Upvotes: 0
Reputation: 33252
The snippet you sent is correct ( a part the string result = string.Empty;
that is absolutely pointless). If you feel the application blocking you should consider using DownloadStringAsync.
Upvotes: 1