string getHost = "http://www.cnblogs.com";

WebClient wClient = new WebClient();
WebProxy p = null; //代理类

string proxyAddressAndPort = "openproxy.tt.com:8080";
string proxyUserName = Class1.u;
string proxyPwd = Class1.p;

ICredentials cre = new NetworkCredential(proxyUserName, proxyPwd); //得到用户名和密码
p = new WebProxy(proxyAddressAndPort, true, null, cre); //将信息放于代理类中(代理服务器URl,是否跳过代理,,身份验证信息)
WebRequest.DefaultWebProxy = p; //为Web请求设置代理

string retval = wClient.DownloadString(getHost);

 

相关文章:

  • 2021-08-17
  • 2021-07-25
  • 2021-11-18
  • 2021-09-20
  • 2021-07-25
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-23
  • 2021-05-02
  • 2021-12-10
  • 2022-01-01
相关资源
相似解决方案