473,404 Members | 2,114 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,404 software developers and data experts.

Error when trying to connect over HTTPS using a client certificate.

Hi,

I am trying to connect over HTTPS using a client certificate. I am able to
connect fine when using IE. From my application, however, I get the
following error:

The underlying connection was closed: Could not establish secure channel for
SSL/TLS.
at System.Net.HttpWebRequest.CheckFinalStatus() at
System.Net.HttpWebRequest.EndGetRequestStream(IAsy ncResult asyncResult) at
System.Net.HttpWebRequest.GetRequestStream() at Project1.Page_Load(Object
sender, EventArgs e) in
d:\temp\vswebcache\myMachine\project1\webform1.asp x.cs:line 47.

I have installed the certificate on the development machine and the
certificate has the private key included. From the application, I use a
DER-encoded X.509 certificate which does not include the private key. I am
able to read the certificate and its properties from within the application,
so I know the certificate is fine.

I am attaching the code that I am using. Any help would be greatly
appreciated!

Thanks,

Subra
************************************************** *

ServicePointManager.CertificatePolicy = new CertificatePolicy();
X509Certificate cert = X509Certificate.CreateFromCertFile(certfile);
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.ClientCertificates.Add(cert);
req.Method = "POST";
req.KeepAlive = false;
req.ContentLength = requestXML.Length;
Stream reqStream = req.GetRequestStream(); //******** error occurs on this
line.
StreamWriter sw = new StreamWriter(reqStream);
sw.Write(requestXML);
sw.Close();
************************************************** *
Nov 17 '05 #1
0 931

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

Similar topics

5
by: John Xu | last post by:
I have a question regarding https and SSL between two web sites. I am not quit understand how asp application can handle https, encryption and SSL. Here is scenario: An asp application on my web...
1
by: Leonard Danao | last post by:
I get this error when i run my code below "An unhandled exception of type 'System.Net.WebException' occurred in system.dll Additional information: The remote server returned an error: (401)...
0
by: Subra Mallampalli | last post by:
Hi, I am trying to connect over HTTPS using a client certificate. I am able to connect fine when using IE. From my application, however, I get the following error: The underlying connection...
5
by: S.Vidya | last post by:
when accessing the URL using Https,the security alert box pop up everytime. how to block that security alert box showing 1.Certificate issued by a company you have not choosen to trust.view the...
0
by: David Mediavilla | last post by:
I am writing a client for an HTTPS web service using WSE 1.0 but I always get an error like "The underlying connection was closed: An unexpected error occurred on a send." Sometimes the error...
4
by: Matthew.DelVecchio | last post by:
hello, i am developing an ASP.NET web app that consumes a 3rd party vendor webservice. it is my first one so while ive done my homework, im not an expert on the matter. our partner's...
14
by: david | last post by:
I have developed web forms including login by using ASP.NET via HTTP. Now I want to secure the connection from client to the server via HTTPS. How can I configure the server or something else to...
4
by: bkasmai | last post by:
My asp.net application (developed using vs2003) runs fine on a windows 2000 server using iis 5.0. Our network manager wants to do away with any http connections and only use https for services that...
5
by: =?Utf-8?B?V2VsdVI=?= | last post by:
I have a web client application built on .Net Frameworks 2.0 that connects to a web service on IIS 6.0 via SSL and using X509 Client Certificates. At some locations (it works at others), I get the...
2
by: =?Utf-8?B?U2NvdHQ=?= | last post by:
I have seen numerous posts, both here and google, where people are having this issue, but I have yet to see an explanation of the problem. I have a WCF service that is working fine using http....
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
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,...
0
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...

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.