Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

222
Views
Why is HttpClient authentication behaving differently between .Net Framework 4.6.2 and .Net Core 5?

I have the same code as below targeting .Net Framework 4.6.2 and .Net Core 5 but seems to yield different authentication behavior.

The .Net Framework version works fine with WWW-Authenticate: Negotiate but the same code fails with the .Net Core version.

Here's the code snippet that I'm using for both.

var server = "https://www.example.com";
var client = new HttpClient(new HttpClientHandler { UseDefaultCredentials = true }) { BaseAddress = new Uri(server) };

var response = await client.GetAsync("/api/token");
var result = response.Content.ReadAsStringAsync().Result;

Console.WriteLine(result);

And here's the entire failure response.

StatusCode: 401, ReasonPhrase: 'Unauthorized', Version: 1.1, Content: System.Net.Http.HttpConnectionResponseContent, Headers:
{
  Cache-Control: no-cache
  Pragma: no-cache
  WWW-Authenticate: Negotiate
  X-Powered-By: ASP.NET
  Date: Fri, 02 Jul 2021 08:30:51 GMT
  Content-Type: application/json; charset=utf-8
  Expires: -1
  Content-Length: 68
}

Is there anything else I missed in the .Net Core version?

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!