Visual Basic https get request - 接受SSL

时间:2017-09-15 14:03:38

标签: vb.net ssl https get request

我正在尝试使用Visual Basic(Visual Basic Express 2010)创建https请求。 如果我尝试使用http - 一切正常。 如果我尝试https - 由于SSL证书而引发错误。

如果我尝试添加此内容:

ServicePointManager.ServerCertificateValidationCallback = _
  New RemoteCertificateValidationCallback(AddressOf AcceptAllCertifications)

它表示未声明“AcceptAllCertifications”。我做错了什么?

谢谢

1 个答案:

答案 0 :(得分:1)

您为该事件连接了一个处理程序,但没有添加该方法。尝试将此添加到您的班级:

Public Function AcceptAllCertifications(
    sender As Object,
    certificate As X509Certificate,
    chain As X509Chain,
    sslPolicyErrors As SslPolicyErrors
) As Boolean

     Return True

End Function