I have a process where I need to do a GET against a URL and receive an
XML response. I have to verify authenticity with this site, so need a
cert attached to the post. I was provided ASP code which works fine,
but I need to do this in .NET. I'm using Framework 1.1 and WSE2.0.
This is (most of) my code:
Dim certStore As WseX509.X509CertificateStore =
WseX509.X509CertificateStore.LocalMachineStore(WseX509.X509CertificateStore.MyStore)
Dim open As Boolean = certStore.OpenRead()
Dim cert2 = GetCertificate("MyCertName", certStore)
wrequest = CType(WebRequest.Create(url), HttpWebRequest)
With wrequest
.Method = "GET"
.Timeout = 5000
.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()
The service keeps responding back saying the Cert is not attached - but
I can query it when it's attached to the GET and it looks ok to me.
Any thoughts?
jfulcer - 15 Aug 2005 23:33 GMT
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!