Bad/Invalid Certificate

ccc

Member
Joined
Dec 13, 2002
Messages
8
I dont know if anyone else has run into this, but if your using a webclient, or webrequest, and you goto a site with an expired/invalid SSL certificate it will error.

Example:
Code:
Dim webreq As New Net.WebClient(), by() As Byte
by = webreq.DownloadData("https://paypal.com/i")
Errors because the cert was issued to www.paypal.com
Debug.WriteLine(System.Text.Encoding.Default.GetString(by))
C#:
System.Net.WebClient webreq = new System.Net.WebClient();
byte[] by;
by=webreq.DownloadData ("https://paypal.com/i");
// Errors because the cert was issued to www.paypal.com
System.Diagnostics.Debug.WriteLine (by);

Gives me a good System.Net.WebException: The underlying connection was closed: Could not establish trust relationship with remote server.

Anyone know a work around (in vb or c#)? My connection must be secure (its not to paypal.com), I dont want to have to use a third party control for something that the net namespace can already do.

Thanks in advance.
 
Back
Top