G
Guest
I have been struggling with this for a couple of weeks.
I have a digital certificate installed in my certificate collection store on
my local computer. The site I am trying to post to also has our certificate
installed is said it is ready to recieve transactions. I have created a file
(xml) and I want to post to the given web address.
An example of the web address is https://some.company.com/location
this is what I have tried:
aStreamReader = New StreamReader("C:\MyTest2.txt")
postData = aStreamReader.ReadToEnd()
Dim data As Byte() = encoding.GetBytes(postData)
Dim myRequest As HttpWebRequest = _
CType(WebRequest.Create("https://some.company.com/location"), _
HttpWebRequest)
myRequest.ClientCertificates.Add( _
Security.Cryptography.X509Certificates.X509Certificate.CreateFromSignedFile _
("C:\MyDigitalCertificate.cer"))
myRequest.Method = "POST"
myRequest.KeepAlive = False
'*******ERROR occurs on this next line when getting request stream******
Dim newStream As Stream = myRequest.GetRequestStream
' Send the data.
newStream.Write(data, 0, data.Length)
newStream.Close()
The error is:
The underlying connection was closed: Could not establish secure channel
for SSL/TLS.
What am i missing? Is there any examples or articles that would help me?
Has anyone else ran into this and could shed some light on this? Am I just
way off on doing this?
I have a digital certificate installed in my certificate collection store on
my local computer. The site I am trying to post to also has our certificate
installed is said it is ready to recieve transactions. I have created a file
(xml) and I want to post to the given web address.
An example of the web address is https://some.company.com/location
this is what I have tried:
aStreamReader = New StreamReader("C:\MyTest2.txt")
postData = aStreamReader.ReadToEnd()
Dim data As Byte() = encoding.GetBytes(postData)
Dim myRequest As HttpWebRequest = _
CType(WebRequest.Create("https://some.company.com/location"), _
HttpWebRequest)
myRequest.ClientCertificates.Add( _
Security.Cryptography.X509Certificates.X509Certificate.CreateFromSignedFile _
("C:\MyDigitalCertificate.cer"))
myRequest.Method = "POST"
myRequest.KeepAlive = False
'*******ERROR occurs on this next line when getting request stream******
Dim newStream As Stream = myRequest.GetRequestStream
' Send the data.
newStream.Write(data, 0, data.Length)
newStream.Close()
The error is:
The underlying connection was closed: Could not establish secure channel
for SSL/TLS.
What am i missing? Is there any examples or articles that would help me?
Has anyone else ran into this and could shed some light on this? Am I just
way off on doing this?