VB .net Accept Self-Signed SSL certificate

后端 未结 4 1874
不思量自难忘°
不思量自难忘° 2021-01-01 14:50

I\'m searching for a way to validate (or bypass validation for) self-signed SSL certificates using VB .Net. I found code to do this in C# and tried converting it into VB co

4条回答
  •  臣服心动
    2021-01-01 15:16

    One-liner:

    System.Net.ServicePointManager.ServerCertificateValidationCallback = _
      Function(se As Object, _
      cert As System.Security.Cryptography.X509Certificates.X509Certificate, _
      chain As System.Security.Cryptography.X509Certificates.X509Chain, _
      sslerror As System.Net.Security.SslPolicyErrors) True
    

    Credits to Robby Tendean

提交回复
热议问题