title: The SSL connection could not be established when using httpclient in c# (.net core) but works in Postman and Browser
body: <p>I have a .net core console app with a function that will do a simple http call and get the page content (this is for a testing). I am getting an issue &quot;The SSL connection could not be established&quot;. But when I try the same url with <strong>Postman</strong> or a <strong>browser</strong> it works fine. Can anyone help me on this?</p>
  <p>inner exception:&quot;Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host..&quot;</p>
  <pre><code>private static async Task&lt;string&gt; CallUrl(string url)
  {
     using var client = new HttpClient();
     using var response = await client.GetAsync(url);
     using var content = response.Content;
     var data = await content.ReadAsStringAsync();
     return data;
  }
  </code></pre>
  <p>I tried the suggestion in <a href="https://stackoverflow.com/questions/52939211/the-ssl-connection-could-not-be-established">The SSL connection could not be established</a> as well. like this but no luck.</p>
  <pre><code>  private static async Task&lt;string&gt; CallUrl(string url)
    {
      var clientHandler = new HttpClientHandler
      {
         ServerCertificateCustomValidationCallback = (sender, cert, chain, sslPolicyErrors) =&gt;
         {
             return true;
         }
      };
      using var client = new HttpClient(clientHandler);
      using var response = await client.GetAsync(url);
      using var content = response.Content;
      var data = await content.ReadAsStringAsync();
      return data;
    }
  </code></pre>