Posting/Getting with a certificate does not work

G

Guest

I am trying to do a get/post with a certificate to another server to gather
information. I was provided with an ASP example that I am able to get my
results fine with, but when I try it in .NET, the server keeps telling me
there is no certificate. I can check the certificate after loading it using
WSE 2 and it looks fine. Here is the code:


Imports System.Security.Cryptography.X509Certificates
Imports Microsoft.Web.Services2
Imports WseX509 = Microsoft.Web.Services2.Security.X509

Dim url As New Uri("https://server.location.com/Getinfo.asp?id=4")
Dim strXMLResponse

Dim wrequest As HttpWebRequest
Dim wresponse As HttpWebResponse
Dim srequest, sresponse As System.IO.Stream
Dim reader As System.IO.StreamReader
Dim writer As System.IO.StreamWriter
Dim XmlRdr As System.Xml.XmlTextReader
Dim strStatus As String
Dim strReturnMessage As String

Dim doc As XmlDocument = New XmlDocument
Dim nodeList As XmlNodeList
Dim root As XmlElement

Dim certStore As WseX509.X509CertificateStore =
WseX509.X509CertificateStore.LocalMachineStore(WseX509.X509CertificateStore.MyStore)
Dim open As Boolean = certStore.OpenRead()
Dim cert2 = GetCertificate("MyCertDescription", certStore)

wrequest = CType(WebRequest.Create(url), HttpWebRequest)
With wrequest
.Method = "GET"
.Timeout = 50000
.ClientCertificates.Add(cert2)
.KeepAlive = False
End With

'get the response from the request
wresponse = CType(wrequest.GetResponse(), HttpWebResponse)
ResponseStream = wresponse.GetResponseStream
'Hook up a streamreader to the stream for ease of reading
ResponseStreamReader = New System.IO.StreamReader(ResponseStream)
strXMLResponse = ResponseStreamReader.ReadToEnd()


Their server responds back in the XML response indicating the cert wasn't
present. The company I am working with has told me I'm the only one trying
it in .NET - everyone else uses ASP so they are no help. I don't know if
there is a difference between using ASP and ASP.NET for cert passing - I
would doubt it but I just don't know what the problem is.
 
G

Guest

After bouncing around Microsoft's support line for a while, it turns out that
my dev machine was NOT running SP1 for the .NET Framework 1.1.

If you do not have SP1 installed, your web service call will not pass the
certificate along as it cannot access the local machine store properly. KB
alert # 901183 mentions you need SP1 and now I know why. It will look like
it was passing it, but doesn't.

Cheers!
 

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

Similar Threads


Top