P
Pedro Roseiro
Im having a problem when i try to get the response of a WebRequest. The error
is "The underlying connection was closed: Could not establish secure channel
for SSL/TLS.".
The code is working fine in a Windows 2000/XP environment but it raises the
error in a Windows 2003 (I tried in 2 diferent machines, both have all the
necessary windows updates). The code im using is the this:
Dim store As Microsoft.Web.Services2.Security.X509.X509CertificateStore
Dim request As HttpWebRequest = HttpWebRequest.Create(url)
store =
Microsoft.Web.Services2.Security.X509.X509CertificateStore.LocalMachineStore(store.MyStore)
store.OpenRead()
request.ClientCertificates.Add(store.FindCertificateBySubjectString(certificateName).Item(0))
request.Method = "POST"
request.ContentType = "text/xml"
Dim bytes As Byte() = Nothing
bytes = System.Text.Encoding.UTF8.GetBytes(data)
request.ContentLength = bytes.Length
Dim outputStream As Stream
outputStream = request.GetRequestStream()
outputStream.Write(bytes, 0, bytes.Length)
outputStream.Close()
Dim reader As StreamReader
reader = New StreamReader(request.GetResponse().GetResponseStream)
retVal = reader.ReadToEnd()
reader.Close()
is "The underlying connection was closed: Could not establish secure channel
for SSL/TLS.".
The code is working fine in a Windows 2000/XP environment but it raises the
error in a Windows 2003 (I tried in 2 diferent machines, both have all the
necessary windows updates). The code im using is the this:
Dim store As Microsoft.Web.Services2.Security.X509.X509CertificateStore
Dim request As HttpWebRequest = HttpWebRequest.Create(url)
store =
Microsoft.Web.Services2.Security.X509.X509CertificateStore.LocalMachineStore(store.MyStore)
store.OpenRead()
request.ClientCertificates.Add(store.FindCertificateBySubjectString(certificateName).Item(0))
request.Method = "POST"
request.ContentType = "text/xml"
Dim bytes As Byte() = Nothing
bytes = System.Text.Encoding.UTF8.GetBytes(data)
request.ContentLength = bytes.Length
Dim outputStream As Stream
outputStream = request.GetRequestStream()
outputStream.Write(bytes, 0, bytes.Length)
outputStream.Close()
Dim reader As StreamReader
reader = New StreamReader(request.GetResponse().GetResponseStream)
retVal = reader.ReadToEnd()
reader.Close()