title: .NET Core HttpClient - "A security error occurred" HttpRequestException
body: <p>Using .NET Core and C# I'm trying to make an HTTPS request to my Vizio TV, the API is somewhat documented <a href="https://github.com/exiva/Vizio_SmartCast_API" rel="nofollow noreferrer">here</a>. </p>
  
  <p>When visiting the HTTP server in Chrome I receive a "NET::ERR_CERT_AUTHORITY_INVALID" error. When I make the request in C# with a <code>HttpClient</code>, a <code>HttpRequestException</code> is thrown. I've tried adding the certificate to Windows but I'm just not familiar enough with TLS. </p>
  
  <p>I'm also not concerned about my communications being snooped on so I would like to just ignore any HTTPS errors. </p>
  
  <p>Here's the relevant code I'm working with.</p>
  
  <pre><code>public async Task Pair(string deviceName) {
      using (var httpClient = new HttpClient())
      try {
          httpClient.BaseAddress = new Uri($"https://{televisionIPAddress}:9000/");
  
          // Assume all certificates are valid?
          ServicePointManager.ServerCertificateValidationCallback =
              (sender, certificate, chain, sslPolicyErrors) =&gt; true;
  
          deviceID = Guid.NewGuid().ToString();
  
          var startPairingRequest = new HttpRequestMessage(HttpMethod.Put, "/pairing/start");
          startPairingRequest.Content = CreateStringContent(new PairingStartRequestBody {
              DeviceID = deviceID,
              DeviceName = deviceName
          });
  
          var startPairingResponse = await httpClient.SendAsync(startPairingRequest); // HttpRequestException thrown here
          Console.WriteLine(startPairingResponse);
      } catch (HttpRequestException e) {
          Console.WriteLine(e.InnerException.Message); // prints "A security error occurred"
      }
  }
  
  StringContent CreateStringContent(object obj) {
      return new StringContent(JsonConvert.SerializeObject(obj), Encoding.UTF8, "application/json");
  }
  </code></pre>