I am trying to load a certificate into a X509Certificate object in order that I can then attach it to a HTTPS POST. I am getting a 403 forbidden error from the server that I am trying to connect to - indicating that the certificate is perhaps not being attached corrctly. I am using VB.NET within and ASP.NET page. Can anyone please help?


Dim myRequest As HttpWebRequest
Dim myResponse As HttpWebResponse

myRequest = CType(WebRequest.Create(theQuoteURL),HttpWebRequest)
myRequest.Method = "POST"

myRequest.ContentType = "text/xml"

Dim cert As X509Certificate = X509Certificate.CreateFromCertFile("C:\Inetpub\wwwroot\config\OSIS\HLAM.cer")

myRequest.ClientCertificates.Add(cert)

#####After this point the remote server does not seem to recognise the certificate that we have tried to attach.