G
Guest
I have a web page that is using a certificate to interact with another web
site. I'm using ASP.Net in VS 2005. If I run it from the IDE it works great.
If I do a Build/Publish Web Site it doesn't work. I get a "The request was
aborted: Could not create SSL/TLS secure channel." The statement appears
after I perform a datastream = oWebreq.GetRequestStream.
My code looks like the following:
sXml = "xml_data=" & Server.UrlEncode(oXML.InnerXml)
oWebreq = Net.HttpWebRequest.Create(sDSXURL)
oWebreq.ClientCertificates.Add(oCert)
oWebreq.CookieContainer = New Net.CookieContainer
oWebreq.Method = "POST"
oWebreq.AllowWriteStreamBuffering = False
oWebreq.MaximumAutomaticRedirections = 1
oWebreq.AllowAutoRedirect = False
oWebreq.ContentLength = sXml.Length
oWebreq.ContentType = "application/x-www-form-urlencoded"
Try
datastream = oWebreq.GetRequestStream
datastream.Write(System.Text.Encoding.UTF8.GetBytes(sXml),
0, oWebreq.ContentLength)
datastream.Flush()
datastream.Close()
oWebres = oWebreq.GetResponse
Catch ex As Exception
Response.Write(CONFIGPROBLEM & ex.Message)
Exit Sub
End Try
However, it appears something with the certificate, since I have used other
certificates in the code above without problems.
site. I'm using ASP.Net in VS 2005. If I run it from the IDE it works great.
If I do a Build/Publish Web Site it doesn't work. I get a "The request was
aborted: Could not create SSL/TLS secure channel." The statement appears
after I perform a datastream = oWebreq.GetRequestStream.
My code looks like the following:
sXml = "xml_data=" & Server.UrlEncode(oXML.InnerXml)
oWebreq = Net.HttpWebRequest.Create(sDSXURL)
oWebreq.ClientCertificates.Add(oCert)
oWebreq.CookieContainer = New Net.CookieContainer
oWebreq.Method = "POST"
oWebreq.AllowWriteStreamBuffering = False
oWebreq.MaximumAutomaticRedirections = 1
oWebreq.AllowAutoRedirect = False
oWebreq.ContentLength = sXml.Length
oWebreq.ContentType = "application/x-www-form-urlencoded"
Try
datastream = oWebreq.GetRequestStream
datastream.Write(System.Text.Encoding.UTF8.GetBytes(sXml),
0, oWebreq.ContentLength)
datastream.Flush()
datastream.Close()
oWebres = oWebreq.GetResponse
Catch ex As Exception
Response.Write(CONFIGPROBLEM & ex.Message)
Exit Sub
End Try
However, it appears something with the certificate, since I have used other
certificates in the code above without problems.