C# WebClient with https

后端 未结 1 999
长发绾君心
长发绾君心 2020-12-17 03:12

I want to use https to upload a file using WebClient\'s UploadData method. And I want to ignore server side certificate verification (always accept server certificate and on

相关标签:
1条回答
  • 2020-12-17 03:47

    Try adding this before you send you HTTPS requests (make sure you import System.Net namespace).

    ServicePointManager.ServerCertificateValidationCallback += 
        delegate(object sender, X509Certificate certificate, X509Chain chain, 
        SslPolicyErrors sslPolicyErrors)
    {
       return true;
    };
    
    0 讨论(0)
提交回复
热议问题