WebClient:
使用代理获取网页的HTMLWebProxy proxy = new WebProxy("http://webproxy");
使用代理获取网页的HTMLproxy.Credentials 
= new NetworkCredential(usernamepassworddomain);
使用代理获取网页的HTMLGlobalProxySelection.Select 
= proxy;
使用代理获取网页的HTMLWebClient wc 
= new WebClient();
使用代理获取网页的HTML
使用代理获取网页的HTML
byte[] data = wc.DownloadData("http://www.baidu.com");
使用代理获取网页的HTML
string doc = Encoding.Default.GetString(data);
使用代理获取网页的HTMLConsole.WriteLine(doc);

WebRequest:
使用代理获取网页的HTMLWebProxy proxy = new WebProxy("http://webproxy");
使用代理获取网页的HTMLproxy.Credentials 
= new NetworkCredential(usernamepassworddomain);
使用代理获取网页的HTML
使用代理获取网页的HTMLHttpWebRequest request 
= (HttpWebRequest)HttpWebRequest.Create("http://www.baidu.com");
使用代理获取网页的HTMLrequest.Proxy 
= proxy;
使用代理获取网页的HTML
使用代理获取网页的HTMLHttpWebResponse response 
= (HttpWebResponse)request.GetResponse();
使用代理获取网页的HTMLStream stream 
= response.GetResponseStream();
使用代理获取网页的HTMLStreamReader reader 
= new StreamReader(stream, Encoding.Default);
使用代理获取网页的HTMLConsole.WriteLine(reader.ReadToEnd());

相关文章:

  • 2021-12-24
  • 2022-02-25
  • 2022-12-23
  • 2021-10-17
  • 2021-11-27
  • 2022-12-23
猜你喜欢
  • 2021-11-26
  • 2022-12-23
  • 2021-12-15
  • 2021-12-02
  • 2022-12-23
相关资源
相似解决方案