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(Wse X509.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. 1 2069
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!
"Jeff Fulcer" wrote: 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(Wse X509.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. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Tetedeiench |
last post by:
Hi !
I am currently changing the server for my website, and i make a heavy
use of openssl functions.
Both servers use PHP4.3.3 with OpenSSL 0.9.6i.
I was actually testing with this code,...
|
by: Robin H. Johnson |
last post by:
Hi,
I'm working on a project making large use of OpenSSL to individually
encrypt items inside a database, but I've hit a stumbling block.
There appears to be absolutely no native PHP way (eg...
|
by: Mishi Abolghasem |
last post by:
I'm trying to use this sequence of VB-API calls to post to a web-page where
client certificate is required.(
InternetOpen,InternetConnect,HttpOpenRequest,HttpSendRequest) And then
InternetReadFile...
|
by: Jeff Fulcer |
last post by:
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,...
|
by: Matt Frame |
last post by:
I am working on a special ASP.Net application that receives files from
customers. The connection is made via HTTPS and the client sends the file
as a POST to my ASP.Net listener. All of this...
| |
by: Dave |
last post by:
Is it difficult to write a program that, given an array of URLs, will probe
each one, and return a status of Found or Not Found? How would you approach
it?
While Googling, I found utility after...
|
by: JerryK |
last post by:
Hi,
I have an ASP.net page, written in VB.net. In that code I want to access a
validator web services that is secured via SSL. I have installed the
certificate, via a .pfx file, on the system....
|
by: romiko2000 |
last post by:
Hi Folks,
I got a weird problem, I create an XMLWriter to post a document via the
webrequest stream and after running a network trace, I notice the data
is prefixed with 3 invalid characters!
...
|
by: UnkleVo |
last post by:
I have a winform app that is consuming WebService via SSL connection.
We installed the digital certificate for that and the winform app is
loading that cert at run time.
Code in VB.net looks...
|
by: Joe |
last post by:
Hello,
I'm currently using a C# class library which is also
converted quickly to a console app by adding a MAIN and adjusting the
building configuration. I'm using this page as a reference to the...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |