title: Verify remote SSL certificate during HTTPS request
body: <p>When making HTTPS request to remote web server, I use WebRequest, which establishes secure connection with remote web server. During development, I use self-signed cert on server, and WebRequest fails to establish secure connection, since cert is not valid, which is expected behavior.</p>
  
  <p>I have found this code that "remotes" cert check, activated by calling <code>SetCertificatePolicy()</code> method in following code.</p>
  
  <pre><code>public static void SetCertificatePolicy()
  {
      ServicePointManager.ServerCertificateValidationCallback
                  += RemoteCertificateValidate;
  }
  
  /// &lt;summary&gt;
  /// Remotes the certificate validate.
  /// &lt;/summary&gt;
  private static bool RemoteCertificateValidate(
      object sender, X509Certificate cert,
      X509Chain chain, SslPolicyErrors error)
  {
      // trust any certificate!!!
      System.Console.WriteLine("Warning, trust any certificate");
      return true;
  }
  </code></pre>
  
  <p>I am wondering, if it is possible to do special checks on remote SSL cert (using above code, for instance), so that I can verify that remote web server uses valid SSL cert, and not just any valid cert, but exactly the one I want? For instance, I want to make sure that I'm talking to www.someplace.com website, cert issued to ACME Inc, with fingerprint 00:11:22:.....</p>
  
  <p>What is a "best practice" approach for this scenario?</p>
  
  <p>Thanks!</p>