473,795 Members | 3,440 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

httpWebRequest not sending client Certificate

my asp.net app is posting to another webpage using httpwebRequest &
x509Certificate s 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\p ersonal store in CA in the
trusted root authority.

I'm also using window server 2003

code that POSTs:

void SendTestXML2(ob ject sender, System.EventArg s e)
{
string XMLRequest = "";
System.Net.Serv icePointManager .CertificatePol icy = new MyPolicy();
try

{

string loginUrl =
"https://aestheticpc.com/qbConn/CertCheck/CertCheckaspx.a spx"; XMLRequest =
buildXML();
X509Certificate cert =
X509Certificate .CreateFromCert File("ClientCer tDER2.cer");
HttpWebRequest wr = (HttpWebRequest ) WebRequest.Crea te(loginUrl);
wr.ClientCertif icates.Add(cert );
wr.Method = "POST";
wr.KeepAlive = false;
wr.ContentType = "applicatio n/x-qbxml";
wr.ContentLengt h = XMLRequest.Leng th;

// send xml data
StreamWriter SendStream;
SendStream = new StreamWriter(wr .GetRequestStre am());

SendStream.Writ e(XMLRequest);
SendStream.Flus h();
SendStream.Clos e();
HttpWebResponse WebResp = (HttpWebRespons e) wr.GetResponse( );
string res = "";
using (StreamReader sr = new
StreamReader(We bResp.GetRespon seStream()) )
{

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.ToSt ring());

}

}

code that Responds:

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

Dim cs As HttpClientCerti ficate = Request.ClientC ertificate
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 4680
"Marvin" <Ma****@discuss ions.microsoft. com> skrev i en meddelelse
news:A3******** *************** ***********@mic rosoft.com...
my asp.net app is posting to another webpage using httpwebRequest &
x509Certificate s 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
12940
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
3570
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 place to post this... I have a winform app that is using HttpWebRequest to connect to a site using SSL (i.e. "https://..."). The vendor requires me to validate some information on the client certificate I get from their server (to make sure...
9
4885
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 this to several different addresses with no luck. I've tried to supply a new ICertificatePolicy to the ServicePointManager as well. The oddity of the error that I'm receiving is it's happening before any data is even sent. Note: This code works...
1
3908
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 object.I use httpwebrequest to retrieve data. The certificate is added to the client certificates collection. When this component is called from a windows application, I can retrieve the data. When this component is called from a web page, I get the...
2
13060
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 the client application should also use a self-signed certificate (of course, signed by the same self-made CA) so we would have an authentication of both directions: the server to the client and the other way round. Is there a way to...
2
16384
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 requires a client certificate which they have provided in .cer format. I can connect ok to their test service which uses SSL but doesnt require a client certificate with the code below. I dont have great deal of knowledge about client certificates...
0
1431
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 = X509Certificate.CreateFromCertFile(certFile);
0
2441
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 server certificate. However, I keep getting an error "Unable to connect to remote server". I know I am able to connect to their server and retrieve an XML response as we were able to do this using our old solution (WinHTTP in Visual Basic 6). ...
1
4383
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: X509Certificate Cert = X509Certificate.CreateFromCertFile("...some path\\export.cer"); HttpWebRequest Request = (HttpWebRequest)WebRequest.Create("https://...some URL..."); Request.ClientCertificates.Add(Cert); Request.UserAgent = "Client Cert Sample";...
0
9672
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9519
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9042
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7538
isladogs
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6780
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5437
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2920
bsmnconsultancy
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.