其实就几行代码
代码语言:javascript复制if (strUrl.StartsWith("https", StringComparison.OrdinalIgnoreCase))
{
request.Credentials = CredentialCache.DefaultCredentials;
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
request.ProtocolVersion = HttpVersion.Version11;
ServicePointManager.CheckCertificateRevocationList = true;
ServicePointManager.DefaultConnectionLimit = 100;
ServicePointManager.Expect100Continue = false;
}