473,396 Members | 1,923 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

httpWebRequest not sending client Certificate

my asp.net app is posting to another webpage using httpwebRequest &
x509Certificates and in return the certificate's name used for the posting is
sent back. But instead of getting information about the cert returned I'd get
no information message.

I know my certificate is valid because when I manually type the address my
app is posting to in IE it would return the client certificate's name used in
my users personal store.

So basically, HttpwebRequest is not sending the client certificate.

I have the cert installed in local_machine\personal store in CA in the
trusted root authority.

I'm also using window server 2003

code that POSTs:

void SendTestXML2(object sender, System.EventArgs e)
{
string XMLRequest = "";
System.Net.ServicePointManager.CertificatePolicy = new MyPolicy();
try

{

string loginUrl =
"https://aestheticpc.com/qbConn/CertCheck/CertCheckaspx.aspx"; XMLRequest =
buildXML();
X509Certificate cert =
X509Certificate.CreateFromCertFile("ClientCertDER2 .cer");
HttpWebRequest wr = (HttpWebRequest) WebRequest.Create(loginUrl);
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(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 that Responds:

Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)

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
End Sub
Nov 18 '05 #1
1 4620
"Marvin" <Ma****@discussions.microsoft.com> skrev i en meddelelse
news:A3**********************************@microsof t.com...
my asp.net app is posting to another webpage using httpwebRequest &
x509Certificates and in return the certificate's name used for the posting is sent back. But instead of getting information about the cert returned I'd get no information message.


This is an ancient ASP.NET bug:

FIX: ASP.NET Web application cannot deliver a client certificate to a secure
Web site
http://support.microsoft.com/?kbid=817854

Unfortunately this involves getting your hands on the ASP.NET 1.1 June 2003
(Yes, 2003 Virginia!!!) Hotfix Rollup Package:

http://support.microsoft.com/default.aspx?kbid=821156

As there is no servicepack for 1.1, you will need to get this hotfix from
Microsoft Product Support Services. It cannot be downloaded from
microsoft.com. Alternatively you could wait for 2.0. :-)

For Windows 2003, note that you should install the OCM hotfix package
*INSTEAD OF* the Windows Installer package.

Jens

--
Jens Christian Mikkelsen
http://www.jcmikkelsen.dk
Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: EMonaco | last post by:
Is there any way to programmatically select a particular client certificate and associate it with an HttpWebRequest instance? I know using WinINet this was possible. Erin.
1
by: Curtis Justus | last post by:
Hello, I tried posting this in the aspnet.security group, but it seemed like some posts in this group are closer to what I'm looking for. In any event, I apologize in advance if this isn't the...
9
by: Matt Sollars | last post by:
I've exhausted all other avenues with this problem. Any help would be greatly appreciated. I am performing a simple POST via a HttpWebRequest object to an SSL URL (https://). I have attempted...
1
by: Deepak | last post by:
We retrieve data from a company called XYZ through httpwebrequest. The program is coded using VB.NET They have given a certificate to install. This certificate is included with the request...
2
by: Josef Brunner | last post by:
Hi everybody, my VB.NET (Framework 2.0) client application has to do a HttpWebRequest (for reading web-pages and downloading files) on a web server. The server uses a self-signed certifiacte and...
2
by: steveS | last post by:
Hi all, I'm having trouble connecting to a Java web service using HttpWebRequest. I get the error message "The request was aborted: Could not create SSL/TLS secure channel". The Java service...
0
by: calebmeii | last post by:
Hi, Anyone's help is really appreciated! VS05 with .net 2.0, on Windows XP/2003 IIS 5/6, on ASP, When post a HttpWebRequest with client ceritificate X509Certificate cert =...
0
by: nomad | last post by:
Hi, I am using HTTPWebRequest to add a client certificate. I am then using HTTPWebRequest to POST xml to a web service which requires the attached client certificate to authenticate with their...
1
by: am1974po | last post by:
I have 2 applications: One is simple windows application and the other is web service. They are both on the same machine, windows server 2003 - SP2. exactly the same code in both:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
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...
0
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...
0
tracyyun
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...
0
agi2029
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.