日期:2014-05-18 浏览次数:20838 次
HttpWebRequest objHttpRequest; HttpWebResponse objResponse; WebProxy objProxy; objHttpRequest = (HttpWebRequest)WebRequest.Create("http://www.baidu.com"); //设定测试页面,用百度来测试 objHttpRequest.Timeout = 3000; //设定超时时间 string ip = "122.72.2.200"; int port = 80; objProxy = new WebProxy(ips, ports); //创建proxy objProxy.BypassProxyOnLocal = false; objHttpRequest.Proxy = objProxy; try { objResponse = (HttpWebResponse)objHttpRequest.GetResponse();//获取答复 } catch (Exception) { }