Created
June 15, 2021 00:02
-
-
Save jbollman7/f9e9b690d5b746e82556add0cc5af988 to your computer and use it in GitHub Desktop.
SSL Hanlder. when invalid/selfsigned certs got you down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Net.Http; | |
using System.Security.Authentication; | |
namespace Auth_ConnectionLib | |
{ | |
public static class SslHandle | |
{ | |
public static HttpClientHandler FixInvalidSsl() | |
{ | |
var httpClientHandler = new HttpClientHandler | |
{ | |
SslProtocols = SslProtocols.Tls12 | SslProtocols.Tls11 | SslProtocols.Tls, | |
ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => true | |
}; | |
return httpClientHandler; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment