|
HttpHelper累的片段
//设置代理服务器
if (objhttpItem.ProxyIp.Contains(":"))
{
string[] plist = objhttpItem.ProxyIp.Split(':');
WebProxy myProxy = new WebProxy(plist[0].Trim(), Convert.ToInt32(plist[1].Trim()));
//建议连接
myProxy.Credentials = new NetworkCredential(objhttpItem.ProxyUserName, objhttpItem.ProxyPwd);
//给当前请求对象
request.Proxy = myProxy;
}
else
{
WebProxy myProxy = new WebProxy(objhttpItem.ProxyIp, false);
//建议连接
myProxy.Credentials = new NetworkCredential(objhttpItem.ProxyUserName, objhttpItem.ProxyPwd);
//给当前请求对象
request.Proxy = myProxy;
}
其中 myProxy.Credentials = new NetworkCredential(objhttpItem.ProxyUserName, objhttpItem.ProxyPwd);
代理服务器名和密码 是用于在代理服务器验证的吗?我调用NetworkCredential类的无参的构造函数好像不行...
|
|