ASP.NET Certificate Problem on Windows 2003

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

Pedro Roseiro

Some more information:
- it doesn't work only in ASP.NET environment. Using Windows Forms App it
works OK.
- i've granted permissions on the store to ASPNET user. It was a request to
make it work in Windows 2K environment.
- i suspect it's a security problem.
- Till now i couldn't find any workaround.
 

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

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top