I am working on a C# .NET application that requires communication with different services on different servers. I have no part on the server's configuration, so I have to work with the security demands that they have. All of the communication is made with http calls using Flurl.
I get information from a server that demands SecurityProtocolType to be set to TLS 1.2, so before I send my http request, I set it on my code:
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
And that works just fine. Problem is I have to get information from another server that just won't let me authenticate if I have any SecurityProtocol set on ServicePointManager. If I comment my previous set on SecurityProtocol, I can authenticate. If I don't, I can't.
Is there any way I can "unset", ignore or remove that ServicePointManager.SecurityProtocol setting? I have tried do set it to SystemDefaul, and all tls and ssl options, but it will work only if I don't set it at all.
On this second communication (the one where I can't have SecurityProtocol set), I am also ignoring SSL problems with
System.Security.Cryptography.X509Certificates.X509Chain chain, System.Net.Security.SslPolicyErrors sslPolicyErrors) {return true;};