La fonction suivante permet d'effectuer une requête HTTPS sur un serveur ayant un certificat invalide et d'intercepter l'erreur SSL afin de ne pas générer une exception

       using System;
       using System.IO;
       using System.Net;
       using System.Net.Security;
       using System.Security.Cryptography.X509Certificates;
       string Get(string url)
       {
           WebClient client = new WebClient();
           HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
           request.Credentials = new NetworkCredential("admin", "password");
           request.ServerCertificateValidationCallback =
               delegate (Object obj, X509Certificate certificate, 
                              X509Chain chain, SslPolicyErrors errors)
               {
                   return (true);
               };
           HttpWebResponse response = (HttpWebResponse)request.GetResponse();
           var reader = new StreamReader(response.GetResponseStream());
           return (reader.ReadToEnd());
       }