标签:
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);
标签:
原文地址:http://www.cnblogs.com/gossip/p/4263646.html