質問

I want to send out a POST with a specific certificate using WebClient. Request you to kindly help. I want something like this.

Dim  myWebClient As New WebClient()
mywebclient.ClientCertificates.Add(new X509Certificate()
Dim responseArray1 As Byte() = myWebClient.UploadValues(finalurl1, "POST", myNameValueCollection1)

Please help .

役に立ちましたか?

解決

The answer is here: How can you add a Certificate to WebClient (C#)?

Converted to VB (untested):

Public Class MyWebClient
    Inherits WebClient

    Protected Overrides Function GetWebRequest(ByVal address As System.Uri) As System.Net.WebRequest
        Dim R = MyBase.GetWebRequest(address)
        If TypeOf R Is HttpWebRequest Then
            With DirectCast(R, HttpWebRequest)
                .ClientCertificates.Add(new X509Certificate())
            End With
        End If
        Return R
    End Function
End Class
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top