这是我现在的代码
using (WebClient client = new WebClient())
{
Console.WriteLine(client.DownloadString("http://bot.whatismyipaddress.com/"));
}
现在,我想为代理提供2个选项。
我似乎无法弄清楚如何将其与上述代码连接起来
答案 0 :(得分:1)
using (WebClient client = new WebClient()) {
client.Proxy = new WebProxy("31.4.5.26", 8080); // proxy's host,port
client.Proxy.Credentials = new NetworkCredential("proxyuser", "proxypassword");
Console.WriteLine(client.DownloadString("http://bot.whatismyipaddress.com/"));
}
对我来说很好!