ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true; using (WebClient client = new WebClient()) { string url = "https://api.example.com/data"; string response = client.DownloadString(url); Console.WriteLine(response); }
以前一直使用第三方或是webrequest 之类 新的来了 就使用一下 结果还https的请求 根据验证过程,远程证书无效
特此记录一句
ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true;标签:Web,chain,证书,C#,https,远程,WebClient From: https://www.cnblogs.com/stweily/p/17806835.html