Reputation: 197
public const string url =
"http://www.londonstockexchange.com/exchange/prices-and-markets/international-markets/indices/home/ftse-mib.html";
public static void Main(String[] args)
{
WebClient wc = new WebClient();
string s = wc.DownloadString(url);
}
When I run this code I get the error message: The remote server returned an error: (407) Proxy Authentication Required. I have no idea what to do, can someone give me some advice?
Upvotes: 0
Views: 1203
Reputation: 3328
Try this:
WebClient wc = new WebClient();
wc.Headers.Add("user-agent", "Testing...");
WebProxy proxyObject = new WebProxy(url);
proxyObject.Credentials = CredentialCache.DefaultCredentials;
wc.Proxy = proxyObject;
string s = wc.DownloadString(url);
Refer this link to know about WebClient Headers.
Upvotes: 2