0

I am running into an odd TLS error when using HttpClient in a .NET 6 app. The code is pretty simple and works 99.9% of the time. However, there is one site (ultipro.com) that keeps failing on TLS Handshake. I've looked at their site/certificates and they use TLS1.2 which should be no problem for this version of .NET.

My code:

try { string url; //Examples: These do not work --> SSL Error url = "https://recruiting.ultipro.com/LOS1000LADOD/JobBoard/5365ad6e-23ff-4703-bb77-1e9451fb855e/OpportunityDetail?opportunityId=3b914758-c414-4f1d-a8f2-7d5c0e453cca"; //url = "https://recruiting.ultipro.com/GRA1017GRYT/JobBoard/ae441110-89bd-444d-8ad2-b76c7b9db7a9/OpportunityDetail?opportunityId=acb56de2-b21f-49a1-9c48-7da6d7e47491" //Example: Works fine //url = "https://www.foxcareers.com/Search/JobDetail/R50016539"; using (var client = new HttpClient()) { var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, url); var response = await client.SendAsync(httpRequestMessage); if (response.IsSuccessStatusCode) { using (var contentStream = await response.Content.ReadAsStreamAsync()) { StreamReader reader = new StreamReader(contentStream, Encoding.GetEncoding("utf-8")); string content = reader.ReadToEnd(); } } else { Console.WriteLine("Internal server Error"); } } } catch (Exception ex) { string errormsg = ex.Message; } 

The Error:

The SSL connection could not be established, see inner exception. Inner Exception: Authentication failed because the remote party sent a TLS alert: 'HandshakeFailure'. Source: System.Net.Security 

I've tried everything I can think of including adding/removing different headers and specifying the TLS version. Ex:

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; 

These URLs work just fine in my browser and Postman. Any ideas on what I'm overlooking?

4
  • 1
    Maybe check the details & differences with ssllabs.com/ssltest/index.html Commented Jan 6, 2022 at 4:42
  • Try specifying HttpClientHandler.SslProtocols for defining TLS protocol. Commented Jan 6, 2022 at 4:44
  • I says "Failed to communicate with the secure server" for recruiting.ultipro.com: ssllabs.com/ssltest/…. Strange! Commented Jan 6, 2022 at 4:50
  • @Julian - good tip and I noticed the same thing. Maybe its a problem on their end. But I still don't see why Postman and any browser (Chrome/FF/Safari) work just fine?? Commented Jan 6, 2022 at 4:58

1 Answer 1

1

UPDATE 1-6-2022:

OK - This is weird but everything seemingly got fixed overnight on their end. Code works just fine now. Maybe they introduced a bad cipher and I just happened to run into it exactly on the day they were fixing it but I have no problems this morning. Seems like a big coincidence but at least good folks like @Julian helped me know that I'm not crazy.

Sign up to request clarification or add additional context in comments.

1 Comment

I've had problems in the past with unsupported ciphers - this seems like the same problem

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.