By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,983 Members | 1,627 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,983 IT Pros & Developers. It's quick & easy.

X509Certificate

P: n/a
I'm porting a small piece of Java that will fetch HTML from a secured web
page. The Java code was purposely written to accept any client
certificate - even out of date certificates. This was accomplished by
implementing an X509TrustManager that accepted any certificate.

I'm trying to understand how to do the equivalent in .Net.

Does anyone know how to do this? Help would be very much appreciated.
Thanks in advance.

Joe
Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
In VS.NET, we can retrieve HTML with a HttpWebRequest object, it has a
property named "ClientCertificates", we can specify the certificates here.
Here is some sample code:

wreq.Method = "POST";
string poststring = postParameters ;
wreq.ContentType = "text/xml";

X509Certificate A2WCert = X509Certificate.CreateFromCertFile("c:\c1.cer");
wreq.ClientCertificates.Add(A2WCert);

HttpWebResponse wresp= (HttpWebResponse)wreq.GetResponse();

Client certificates Accepted by serverside replys on IIS. By default, it
will reject a out-of-date client certificate.

For more information, you may check docuements on following namespace in
MSDN:

System.Security.Cryptography.X509Certificates

Luke

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.