ASP.NET Certificate Problem on Windows 2003

R

Ricardo Francisco

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()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top