WebClient 代理 Https 问题
WebClient Proxy Https Issue
我已阅读有关使用代理的 SSL 问题的文章,我认为它是 ssl 证书验证的原因。但是我已经测试了不同的方法来将它设置为始终接受 SSL 但没有成功。我的代码适用于 HTTP,但对于 HTTPS,它 "hangs" 在连接时失败。
我的代码:
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
string response;
try
{
using (WebClient wc = new WebClient())
{
var ProxyA = "192.168.0.103:8888".Split(':');
string PHost = ProxyA[0];
int PPort = Int32.Parse(ProxyA[1]);
wc.Proxy = new WebProxy(PHost, PPort);
response = wc.DownloadString("https://www.mittip.se");
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
我已阅读有关使用代理的 SSL 问题的文章,我认为它是 ssl 证书验证的原因。但是我已经测试了不同的方法来将它设置为始终接受 SSL 但没有成功。我的代码适用于 HTTP,但对于 HTTPS,它 "hangs" 在连接时失败。
我的代码:
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
string response;
try
{
using (WebClient wc = new WebClient())
{
var ProxyA = "192.168.0.103:8888".Split(':');
string PHost = ProxyA[0];
int PPort = Int32.Parse(ProxyA[1]);
wc.Proxy = new WebProxy(PHost, PPort);
response = wc.DownloadString("https://www.mittip.se");
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}