8.2Ignoring SSL certificate validation (https errors)
Created on Aug 17, 2026~1 min read
If a certificate error such as The SSL connection could not be established, see inner exception. occurs while sending an HTTP remote request, you can ignore SSL certificate validation by adding the following configuration:
// Default client configurationservices.AddHttpClient(string.Empty) .ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler { // Ignore SSL certificate validation ServerCertificateCustomValidationCallback = HttpRemoteUtility.IgnoreSslErrors, SslProtocols = HttpRemoteUtility.AllSslProtocols });// If using SocketsHttpHandler, you can ignore SSL certificate validation with the following configurationservices.AddHttpClient(string.Empty) .ConfigurePrimaryHttpMessageHandler(() => new SocketsHttpHandler() { SslOptions = new SslClientAuthenticationOptions { // Ignore SSL certificate validation RemoteCertificateValidationCallback = HttpRemoteUtility.IgnoreSocketSslErrors, EnabledSslProtocols = HttpRemoteUtility.AllSslProtocols }, });In addition to ignoring SSL certificate validation in the global configuration, you can also ignore SSL certificate validation for a single request via the SetHttpClientProvider method. The sample code is as follows:
HttpRequestBuilder.Get("https://furion.net/") .SetHttpClientProvider(() => (new HttpClient(new HttpClientHandler { // Ignore SSL certificate validation ServerCertificateCustomValidationCallback = HttpRemoteUtility.IgnoreSslErrors, SslProtocols = HttpRemoteUtility.AllSslProtocols }), client => client.Dispose()));