title: How to ignore SSL policy to perform a HTTPClient request?
body: <p>I'm trying to ignore ssl policy to do a request with HttpClient but ServerCertificateValidationCallback is never called. What is the correct place to invoke ServerCertificateValidationCallback in ASP.NET Core App? I put it before HttpClient using.</p>
  
  <p>Note: This class is in net462 Class Library. </p>
  
  <p>Code:</p>
  
  <pre><code> System.Net.ServicePointManager.ServerCertificateValidationCallback += 
   delegate (object sender,      
   System.Security.Cryptography.X509Certificates.X509Certificate certificate,
   System.Security.Cryptography.X509Certificates.X509Chain chain,
   System.Net.Security.SslPolicyErrors sslPolicyErrors)
   {
       return true; 
   };
  
   using (var client = new HttpClient())
   {
      client.BaseAddress = new Uri("https://myapi");
      ...
  
      var result = client.PostAsync(method, httpContent).Result;
      ...
   }
  </code></pre>