C # application can no longer get to the website after switching to TLS 1.2 - crash in GetResponse ()

We have an internal application that calls XML requests on our vendor sites. For PCI and security reasons, they begin to disable everything except TLS 1.1 and TLS 1.2. They created a test site with this new requirement for testing.

Our application (C #, Windows Forms application, .NET 4.5) can connect to their current site just fine. When I try to call a new test site, it fails when called GetRequestStream()with "Connected connection was closed: An unexpected error occurred while sending."

If I update the application and ask: System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12

It then gets the value GetRequestStream()and fails when called GetResponse()with "Connected connection was closed: connection was unexpectedly closed."

I tried a bunch of things, none of which worked. I install UserAgent, I tried to set KeepAlive = false, ... If I go to the sellers URL in the browser, I can handle this. I just have problems with my applicationC#

Any thoughts? I obviously do not have access to their server. Is there any setting on my machine that I need to change?

+4
source share
2 answers

, , , TLS. , (, wirehark) . TLS , , , , .

0

, SSL. .NET, - SSL, ServerCertificateValidationCallback. Debug, :

#if DEBUG
ServicePointManager.ServerCertificateValidationCallback += ValidationCallback; 
#endif

var webRequest = HttpWebRequest.Create("https://your.url");
...

#if DEBUG
bool ValidationCallback(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
        {
            return true;
        }
#endif

- SSL ( ), ( Release). , sslPolicyErrors, , .

. , SSL , .

0

All Articles