I've read allot about issues over SSL using proxy and i think its cause of the ssl certificate validation. But i have tested different methods to set it to always accept SSL without success. My code works fine for HTTP but for HTTPS it "hangs"on connect and then fails.
My code:
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);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.