×

Loading...
Ad by
Ad by

use ServicePointManager.CertificatePolicy = New clsCert

where clsCert is a class to implemen interface ICertificatePolicy.
for example:

Imports System.Net

Public Class clsCert
Implements ICertificatePolicy

Public Function CheckValidationResult(ByVal srvPoint As ServicePoint, ByVal certificate As System.Security.Cryptography.X509Certificates.X509Certificate, ByVal request As WebRequest, ByVal certificateProblem As Integer) As Boolean Implements System.Net.ICertificatePolicy.CheckValidationResult
Return True
End Function
End Class

In additon, don't forget to supply NetworkCredential with the usual username and password stuff.
Report

Replies, comments and Discussions:

  • 工作学习 / IT技术讨论 / dot net 中有没有SSL SDK?
    需要写个程序,连接到一个HTTPS 的站点,然后进行上传和下载数.
    • use ServicePointManager.CertificatePolicy = New clsCert
      where clsCert is a class to implemen interface ICertificatePolicy.
      for example:

      Imports System.Net

      Public Class clsCert
      Implements ICertificatePolicy

      Public Function CheckValidationResult(ByVal srvPoint As ServicePoint, ByVal certificate As System.Security.Cryptography.X509Certificates.X509Certificate, ByVal request As WebRequest, ByVal certificateProblem As Integer) As Boolean Implements System.Net.ICertificatePolicy.CheckValidationResult
      Return True
      End Function
      End Class

      In additon, don't forget to supply NetworkCredential with the usual username and password stuff.
      • thanks
    • 不应该有特别的要求。用WebRequest, WebResponse等,所有URL中用http://的地方换成https://就可以了