RT:我目前的写法不管用public static void ProxySetting(HttpWebRequest request)
{
WebProxy myProxy = new WebProxy();
Uri newUri = new Uri("proxy.xxx.xxx:3128");
myProxy.Address = newUri;
request.Proxy = myProxy;
}
{
WebProxy myProxy = new WebProxy();
Uri newUri = new Uri("proxy.xxx.xxx:3128");
myProxy.Address = newUri;
request.Proxy = myProxy;
}
WebProxy myProxy = new WebProxy("10.214.45.28:8080", true);
myProxy.Credentials = new NetworkCredential("id", "password");
req.Proxy = myProxy;
这是什么意思?
string url = "";
HttpWebRequest hwr = (HttpWebRequest)HttpWebRequest.Create(url);
hwr.Timeout = 60000;
WebProxy proxy = new WebProxy();
proxy.Address = new Uri("");
proxy.Credentials = new NetworkCredential("", "");
hwr.UseDefaultCredentials = true;
hwr.Proxy = proxy; 或 System.Net.WebRequest.GetSystemWebProxy();HttpWebResponse req= (HttpWebResponse)hwr.GetResponse();
Stream s = req.GetResponseStream();
StreamReader sr = new StreamReader(s, Encoding.UTF8);