title: Accessing a REST service which has a Client Certificate in Xamarin targeting Android
body: <p>Does anyone know the best way to implement accessing a REST service which has a Client Certificate in Xamarin targeting Android?. I'm using .NET Standard 2.0 project for the shared code.</p>
  
  <p>I've tried WebRequestHandler to add the certificate, but mono does not seem to support this and the application won't run. I have also tried HttpClientHandler. </p>
  
  <p>Code snippet below :</p>
  
  <pre><code>ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
  X509Certificate2 certificate = App.CertificateFile;
  
  var handler = new WebRequestHandler
  {
      ClientCertificateOptions = ClientCertificateOption.Manual
  };
  
  handler.ClientCertificates.Add(certificate);
  var client = new HttpClient(handler);
  </code></pre>
  
  <p>There is a similar question posted here <a href="https://stackoverflow.com/questions/25495056/using-custom-ssl-client-certificates-system-net-httpclient-on-mono">Using custom SSL client certificates System.Net.HttpClient on Mono
  </a> but was a while ago so hoping things have improved. My code works correctly from a .Standard 2.0 project if called via a console app, but the same code does not work on the device.</p>