?
Solved

NO Certificate was found HttpWebRequest

Posted on 2004-08-05
4
Medium Priority
?
472 Views
Last Modified: 2012-08-14
I'm using HttpWebRequest and x509Certificate class to Post to another website in my server to check if it sees my client certificate:

in the response I'm getting 'No certificate was found' from the other page.

I have the client cert intalled in the LocalMachine\Personal Store. Let me know what other details you need


CODE FROM Client sending the cert:
X509Certificate cert = X509Certificate.CreateFromCertFile(@"QBClientCertDER2.cer");
              HttpWebRequest wr = (HttpWebRequest) WebRequest.Create(CheckCert.aspx);
            wr.ClientCertificates.Add(cert);                  
              wr.Method = "POST";
              wr.KeepAlive = false;
              wr.ContentType = "application/x-qbxml";
              wr.ContentLength = XMLRequest.Length;
            
              // send xml data
              StreamWriter SendStream;
            SendStream = new StreamWriter(wr.GetRequestStream());
              //SendStream.Write(byteArray,0,byteArray.Length);
            SendStream.Write(XMLRequest);
            SendStream.Flush();
              SendStream.Close();
              HttpWebResponse WebResp = (HttpWebResponse) wr.GetResponse();
              string res = "";

            
                  using (StreamReader sr = new StreamReader(WebResp.GetResponseStream()) )
                  {

                      res = sr.ReadToEnd();

                      sr.Close();

                  }

                        Output.Text = res.ToString();
                  Output.Text += cert.GetName();
                  WebResp.Close();

              }

              catch(Exception err)

              {

                  Response.Write(err.ToString() + "<br>");
             Response.Write(XMLRequest.ToString());

              }

CODE Checking the cert (CheckCert.aspx):
      Dim cs As HttpClientCertificate = Request.ClientCertificate
         If cs.IsPresent Then
             'Get the Organization (O) field from the Subject section.
             Response.Write("Cert subject: " & cs.Get("Subject O"))
         Else
             Response.Write("No certificate was found.")
         End If
0
Comment
Question by:vinny45
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 17

Accepted Solution

by:
AerosSaga earned 2000 total points
ID: 11725262
This will explain what steps you need to take:

http://support.microsoft.com/default.aspx?scid=kb;en-us;320602

http://www.wilsonmar.com/1certs.htm

Regards,

Aeros
0
 

Author Comment

by:vinny45
ID: 11731025
I'm not sure if i wan't to sign an xml object.

Also, i think I've intalled the client cert in  local_machine\personal
and the accompanying CA in the Root folder

0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 11734616
your not signing the xml object your signing the request.
0
 

Author Comment

by:vinny45
ID: 11737682
yes, HttpWebRequest.ClientCertificate.Add.....

any ideas. I think something is preventing HTTPWebrequest from sending the cert to the remote server.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses
Course of the Month12 days, 10 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question