Skip to content

Cannot authenticate IWA services with HTTP/2 enabled #123803

Closed as duplicate
Closed as duplicate

Description

@dotMorten

Description

Using SocketsHandler, If I make a web request to a service that has IWA authentication, the request will fail with 401 if HTTP/2 is enabled. The response is as if the request was made without setting the credentials, leading me to believe there is no authentication sent with http/2.

Reproduction Steps

Run the following code (update URL to an IWA secured endpoint):

var handler = new SocketsHttpHandler();
handler.PreAuthenticate = true;
handler.Credentials = CredentialCache.DefaultCredentials; // Use default Windows credential
// handler.Credentials = new NetworkCredential("username", "password"); // Use specific credential (for instance other non-Windows platforms)

HttpClient httpClient = new HttpClient(handler);

string url = "https://uri-to-IWA-secured-service";
HttpRequestMessage msg = new HttpRequestMessage(HttpMethod.Get, url);
msg.Version = HttpVersion.Version20; // Set this to 1.1 and it'll be OK

HttpResponseMessage response = await httpClient.SendAsync(msg);
response.EnsureSuccessStatusCode(); // Throws 401  if http/2

Expected behavior

Request correctly authenticates regardless of http version.

Actual behavior

System.Net.Http.HttpRequestException: 'Response status code does not indicate success: 401 (Unauthorized).'

>	http2test.dll!Program.<Main>$(string[] args) Line 46	C#
 	[Resuming Async Method]	
 	System.Private.CoreLib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state)	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.Threading.Tasks.VoidTaskResult>.AsyncStateMachineBox<Program.<<Main>$>d__0>.MoveNext(System.Threading.Thread threadPoolThread)	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.TaskAwaiter.OutputWaitEtwEvents.AnonymousMethod__12_0(System.Action innerContinuation, System.Threading.Tasks.Task innerTask)	Unknown
 	System.Private.CoreLib.dll!System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action action, bool allowInlining)	Unknown
 	System.Private.CoreLib.dll!System.Threading.Tasks.Task.RunContinuations(object continuationObject)	Unknown
 	System.Private.CoreLib.dll!System.Threading.Tasks.Task<System.__Canon>.TrySetResult(System.__Canon result)	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.__Canon>.SetExistingTaskResult(System.Threading.Tasks.Task<System.__Canon> task, System.__Canon result)	Unknown
 	[Completed] System.Net.Http.dll!System.Net.Http.HttpClient.SendAsync.__Core|83_0(System.Net.Http.HttpRequestMessage request, System.Net.Http.HttpCompletionOption completionOption, System.Threading.CancellationTokenSource cts, bool disposeCts, System.Threading.CancellationTokenSource pendingRequestsCts, System.Threading.CancellationToken originalCancellationToken)	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.__Canon>.AsyncStateMachineBox<System.Net.Http.HttpClient.<<SendAsync>g__Core|83_0>d>.ExecutionContextCallback(object s)	Unknown
 	System.Private.CoreLib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state)	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.Net.Http.HttpResponseMessage>.AsyncStateMachineBox<System.Net.Http.HttpClient.<<SendAsync>g__Core|83_0>d>.MoveNext(System.Threading.Thread threadPoolThread)	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.__Canon>.AsyncStateMachineBox<System.Net.Http.HttpClient.<<SendAsync>g__Core|83_0>d>.MoveNext()	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.TaskAwaiter.OutputWaitEtwEvents.AnonymousMethod__12_0(System.Action innerContinuation, System.Threading.Tasks.Task innerTask)	Unknown
 	System.Private.CoreLib.dll!System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action action, bool allowInlining)	Unknown
 	System.Private.CoreLib.dll!System.Threading.Tasks.Task.RunContinuations(object continuationObject)	Unknown
 	System.Private.CoreLib.dll!System.Threading.Tasks.Task<System.__Canon>.TrySetResult(System.__Canon result)	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.__Canon>.SetExistingTaskResult(System.Threading.Tasks.Task<System.__Canon> task, System.__Canon result)	Unknown
 	[Completed] System.Net.Http.dll!System.Net.Http.SocketsHttpHandler.SendAsync.__CreateHandlerAndSendAsync|115_0(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken)	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.__Canon>.AsyncStateMachineBox<System.Net.Http.SocketsHttpHandler.<<SendAsync>g__CreateHandlerAndSendAsync|115_0>d>.ExecutionContextCallback(object s)	Unknown
 	System.Private.CoreLib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state)	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.Net.Http.HttpResponseMessage>.AsyncStateMachineBox<System.Net.Http.SocketsHttpHandler.<<SendAsync>g__CreateHandlerAndSendAsync|115_0>d>.MoveNext(System.Threading.Thread threadPoolThread)	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.__Canon>.AsyncStateMachineBox<System.Net.Http.SocketsHttpHandler.<<SendAsync>g__CreateHandlerAndSendAsync|115_0>d>.MoveNext()	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.TaskAwaiter.OutputWaitEtwEvents.AnonymousMethod__12_0(System.Action innerContinuation, System.Threading.Tasks.Task innerTask)	Unknown
 	System.Private.CoreLib.dll!System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action action, bool allowInlining)	Unknown
 	System.Private.CoreLib.dll!System.Threading.Tasks.Task.RunContinuations(object continuationObject)	Unknown
 	System.Private.CoreLib.dll!System.Threading.Tasks.Task<System.__Canon>.TrySetResult(System.__Canon result)	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.__Canon>.SetExistingTaskResult(System.Threading.Tasks.Task<System.__Canon> task, System.__Canon result)	Unknown
 	[Completed] System.Net.Http.dll!System.Net.Http.RedirectHandler.SendAsync(System.Net.Http.HttpRequestMessage request, bool async, System.Threading.CancellationToken cancellationToken)	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.__Canon>.AsyncStateMachineBox<System.Net.Http.RedirectHandler.<SendAsync>d__4>.ExecutionContextCallback(object s)	Unknown
 	System.Private.CoreLib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state)	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.Net.Http.HttpResponseMessage>.AsyncStateMachineBox<System.Net.Http.RedirectHandler.<SendAsync>d__4>.MoveNext(System.Threading.Thread threadPoolThread)	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.__Canon>.AsyncStateMachineBox<System.Net.Http.RedirectHandler.<SendAsync>d__4>.MoveNext()	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.TaskAwaiter.OutputWaitEtwEvents.AnonymousMethod__12_0(System.Action innerContinuation, System.Threading.Tasks.Task innerTask)	Unknown
 	System.Private.CoreLib.dll!System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action action, bool allowInlining)	Unknown
 	System.Private.CoreLib.dll!System.Threading.Tasks.Task.RunContinuations(object continuationObject)	Unknown
 	System.Private.CoreLib.dll!System.Threading.Tasks.Task<System.__Canon>.TrySetResult(System.__Canon result)	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.__Canon>.SetExistingTaskResult(System.Threading.Tasks.Task<System.__Canon> task, System.__Canon result)	Unknown
 	[Completed] System.Net.Http.dll!System.Net.Http.DiagnosticsHandler.SendAsyncCore(System.Net.Http.HttpRequestMessage request, bool async, System.Threading.CancellationToken cancellationToken)	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.__Canon>.AsyncStateMachineBox<System.Net.Http.DiagnosticsHandler.<SendAsyncCore>d__10>.ExecutionContextCallback(object s)	Unknown
 	System.Private.CoreLib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state)	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.Net.Http.HttpResponseMessage>.AsyncStateMachineBox<System.Net.Http.DiagnosticsHandler.<SendAsyncCore>d__10>.MoveNext(System.Threading.Thread threadPoolThread)	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.__Canon>.AsyncStateMachineBox<System.Net.Http.DiagnosticsHandler.<SendAsyncCore>d__10>.MoveNext()	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.TaskAwaiter.OutputWaitEtwEvents.AnonymousMethod__12_0(System.Action innerContinuation, System.Threading.Tasks.Task innerTask)	Unknown
 	System.Private.CoreLib.dll!System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action action, bool allowInlining)	Unknown
 	System.Private.CoreLib.dll!System.Threading.Tasks.Task.RunContinuations(object continuationObject)	Unknown
 	System.Private.CoreLib.dll!System.Threading.Tasks.Task<System.__Canon>.TrySetResult(System.__Canon result)	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.__Canon>.SetExistingTaskResult(System.Threading.Tasks.Task<System.__Canon> task, System.__Canon result)	Unknown
 	[Completed] System.Net.Http.dll!System.Net.Http.AuthenticationHelper.SendWithAuthAsync(System.Net.Http.HttpRequestMessage request, System.Uri authUri, bool async, System.Net.ICredentials credentials, bool preAuthenticate, bool isProxyAuth, bool doRequestAuth, System.Net.Http.HttpConnectionPool pool, System.Threading.CancellationToken cancellationToken)	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.__Canon>.AsyncStateMachineBox<System.Net.Http.AuthenticationHelper.<SendWithAuthAsync>d__17>.ExecutionContextCallback(object s)	Unknown
 	System.Private.CoreLib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state)	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.Net.Http.HttpResponseMessage>.AsyncStateMachineBox<System.Net.Http.AuthenticationHelper.<SendWithAuthAsync>d__17>.MoveNext(System.Threading.Thread threadPoolThread)	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.__Canon>.AsyncStateMachineBox<System.Net.Http.AuthenticationHelper.<SendWithAuthAsync>d__17>.MoveNext()	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.TaskAwaiter.OutputWaitEtwEvents.AnonymousMethod__12_0(System.Action innerContinuation, System.Threading.Tasks.Task innerTask)	Unknown
 	System.Private.CoreLib.dll!System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action action, bool allowInlining)	Unknown
 	System.Private.CoreLib.dll!System.Threading.Tasks.Task.RunContinuations(object continuationObject)	Unknown
 	System.Private.CoreLib.dll!System.Threading.Tasks.Task<System.__Canon>.TrySetResult(System.__Canon result)	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.__Canon>.SetExistingTaskResult(System.Threading.Tasks.Task<System.__Canon> task, System.__Canon result)	Unknown
 	[Completed] System.Net.Http.dll!System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(System.Net.Http.HttpRequestMessage request, bool async, bool doRequestAuth, System.Threading.CancellationToken cancellationToken)	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.__Canon>.AsyncStateMachineBox<System.Net.Http.HttpConnectionPool.<SendWithVersionDetectionAndRetryAsync>d__52>.ExecutionContextCallback(object s)	Unknown
 	System.Private.CoreLib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state)	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.Net.Http.HttpResponseMessage>.AsyncStateMachineBox<System.Net.Http.HttpConnectionPool.<SendWithVersionDetectionAndRetryAsync>d__52>.MoveNext(System.Threading.Thread threadPoolThread)	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.__Canon>.AsyncStateMachineBox<System.Net.Http.HttpConnectionPool.<SendWithVersionDetectionAndRetryAsync>d__52>.MoveNext()	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.TaskAwaiter.OutputWaitEtwEvents.AnonymousMethod__12_0(System.Action innerContinuation, System.Threading.Tasks.Task innerTask)	Unknown
 	System.Private.CoreLib.dll!System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action action, bool allowInlining)	Unknown
 	System.Private.CoreLib.dll!System.Threading.Tasks.Task.RunContinuations(object continuationObject)	Unknown
 	System.Private.CoreLib.dll!System.Threading.Tasks.Task<System.__Canon>.TrySetResult(System.__Canon result)	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.__Canon>.SetExistingTaskResult(System.Threading.Tasks.Task<System.__Canon> task, System.__Canon result)	Unknown
 	[Completed] System.Net.Http.dll!System.Net.Http.Http2Connection.SendAsync(System.Net.Http.HttpRequestMessage request, bool async, System.Threading.CancellationToken cancellationToken)	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.__Canon>.AsyncStateMachineBox<System.Net.Http.Http2Connection.<SendAsync>d__111>.ExecutionContextCallback(object s)	Unknown
 	System.Private.CoreLib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state)	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.Net.Http.HttpResponseMessage>.AsyncStateMachineBox<System.Net.Http.Http2Connection.<SendAsync>d__111>.MoveNext(System.Threading.Thread threadPoolThread)	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.__Canon>.AsyncStateMachineBox<System.Net.Http.Http2Connection.<SendAsync>d__111>.MoveNext()	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.TaskAwaiter.OutputWaitEtwEvents.AnonymousMethod__12_0(System.Action innerContinuation, System.Threading.Tasks.Task innerTask)	Unknown
 	System.Private.CoreLib.dll!System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action action, bool allowInlining)	Unknown
 	System.Private.CoreLib.dll!System.Threading.Tasks.Task.RunContinuations(object continuationObject)	Unknown
 	System.Private.CoreLib.dll!System.Threading.Tasks.Task<System.Threading.Tasks.VoidTaskResult>.TrySetResult(System.Threading.Tasks.VoidTaskResult result)	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.Threading.Tasks.VoidTaskResult>.SetExistingTaskResult(System.Threading.Tasks.Task<System.Threading.Tasks.VoidTaskResult> task, System.Threading.Tasks.VoidTaskResult result)	Unknown
 	[Completed] System.Net.Http.dll!System.Net.Http.Http2Connection.Http2Stream.ReadResponseHeadersAsync(System.Threading.CancellationToken cancellationToken)	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.Threading.Tasks.VoidTaskResult>.AsyncStateMachineBox<System.Net.Http.Http2Connection.Http2Stream.<ReadResponseHeadersAsync>d__74>.ExecutionContextCallback(object s)	Unknown
 	System.Private.CoreLib.dll!System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(System.Threading.Thread threadPoolThread, System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state)	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.Threading.Tasks.VoidTaskResult>.AsyncStateMachineBox<System.Net.Http.Http2Connection.Http2Stream.<ReadResponseHeadersAsync>d__74>.MoveNext(System.Threading.Thread threadPoolThread)	Unknown
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.Threading.Tasks.VoidTaskResult>.AsyncStateMachineBox<System.Net.Http.Http2Connection.Http2Stream.<ReadResponseHeadersAsync>d__74>.ExecuteFromThreadPool(System.Threading.Thread threadPoolThread)	Unknown
 	System.Private.CoreLib.dll!System.Threading.ThreadPoolWorkQueue.Dispatch()	Unknown
 	System.Private.CoreLib.dll!System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()	Unknown
 	System.Private.CoreLib.dll!System.Threading.Thread.StartCallback()	Unknown

Regression?

No, Reproduces on .NET8, 9 and 10 and Windows, MacCatalyst, iOS and Android (might be more but these are the platforms I observed the problem).

Known Workarounds

None that I could find. I can't tell the difference between a normal authentication error (ie missing or invalid network credential), and a valid credential but caused by using HTTP/2.

Configuration

.NET 8-10. Windows, iOS, Android, MacCatalyst

Other information

This prevents us from moving to HTTP/2. since we're required to support IWA secured services, but can't authenticate.

/cc @karelz

Activity

  1. added
    untriaged
    on Jan 30, 2026
  2. dotnet-policy-service commented on Jan 30, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @karelz, @dotnet/ncl
    See info in area-owners.md if you want to be subscribed.

  3. MihuBot commented on Jan 30, 2026

    @MihuBot
  4. wfurt commented on Jan 30, 2026

    @wfurt
    Member

    HTTP/2 spec does not allow session based authentication because of the multiplexing nature of H/2. e.g. this is likely #1582 .... that can be done manually as you noticed @dotMorten

  5. dotMorten commented on Jan 30, 2026

    @dotMorten
    Author

    @wfurt Thanks. I just commented on the linked issue, since this was a duplicate (I swear I searched but didn't find it - that bot is amazing). Closing here to continue in the other issue.

  6. removed
    untriaged
    on Jan 30, 2026
  7. wfurt commented on Jan 30, 2026

    @wfurt
    Member

    BTW what is IWA? If you could set up some site for testing it would likely go long way towards the fix @dotMorten . The linked issues are pretty old. Partially because not many users hit this but also this is something our tests infrastructure does not support very well.

  8. wfurt commented on Jan 30, 2026

    @wfurt
    Member

    Also you do set PreAuthenticate. That does not really work in this case either because of #33964

  9. karelz commented on Jan 30, 2026

    @karelz
    Member

    From offline chat with @dotMorten -- for a temporary workaround, it would be sufficient to detect that authentication failed, so they can retry manually.
    @dotMorten why is 401 not sufficient here?

    (reopening to explore a workaround)

  10. reopened this on Jan 30, 2026
  11. added
    untriaged
    on Jan 30, 2026
  12. dotMorten commented on Jan 30, 2026

    @dotMorten
    Author

    @dotMorten why is 401 not sufficient here?

    Because it is identical to a 401 caused by an invalid credential that wasn't trigged by IWA.

    Basically these two cases render the exact same error:

    handler.Credentials = CredentialCache.DefaultCredentials; // Assuming user's windows credentials ARE allowed to access resource
    msg.Version = HttpVersion.Version20;
    

    and

    handler.Credentials = CredentialCache.DefaultCredentials; // Assuming user's windows credentials AREN'T allowed to access resource
    msg.Version = HttpVersion.Version11;
    

    If a request gets a 401 response, we'll prompt the user to enter their credentials, but for the Windows scenario, they shouldn't be prompted at all if they do have access to the service using their Windows credentials.

    Also we don't want to downgrade to 1.1 if the failure isn't because of IWA, but could be any other number of reasons, like digest authentication. In some of our cases http/2 can give us up to a 100x performance boost (no that's not an exaggeration).

  13. wfurt commented on Jan 30, 2026

    @wfurt
    Member

    The draft linked in #26925 is no longer reachable. Others have similar problems.

    https://support.atlassian.com/jira/kb/http-2-is-downgraded-to-http-11-when-using-negotiate-kerberos-ntlm-authentication/

    At least with NTLM, the authentication does not need to be sessions based, right @filipnavara ? I guess the perf would suffer but at least it would not break things. But I'm not sure if IIS would support that .....

  14. wfurt commented on Jan 30, 2026

    @wfurt
    Member

    In some of our cases http/2 can give us up to a 100x performance boost (no that's not an exaggeration).

    nice. We have often seen degradation but it is good that somebody may enjoy and benefit from H/2

  15. filipnavara commented on Jan 30, 2026

    @filipnavara
    Member

    At least with NTLM, the authentication does not need to be sessions based, right @filipnavara ?

    NTLM definitely needs to be session based as it always requires two requests to fully authenticate.

    (Kerberos doesn't necessarily need to be session based, but if it's wrapped as SPNEGO/Negotiate then it can be single request-response only in the optimistic case where the caller matches the preferred algorithm and sends the token immediately.)

  16. wfurt commented on Jan 30, 2026

    @wfurt
    Member
    handler.Credentials = CredentialCache.DefaultCredentials; 
    msg.Version = HttpVersion.Version20;
    

    will never work with current code base @dotMorten. Default cress cannot to basic or digest auth e.g. it is always Negotiate that is incompatible with H/2. So I think the workaround would be check if crews are DefaultCredentials and set the version accordingly.

  17. dotMorten commented on Jan 30, 2026

    @dotMorten
    Author

    @wfurt we could add an extra probe upfront to try without default credentials. That way we can say "if credentials property set don't use http/2". However that ends up still affecting services that isn't using IWA to authenticate with a network credential
    .

  18. dotMorten commented on Jan 30, 2026

    @dotMorten
    Author

    Just realized there is a way to tell!

    Image
  19. wfurt commented on Jan 30, 2026

    @wfurt
    Member

    yes, but you need to probe it e.g. do extra request.

  20. dotMorten commented on Jan 30, 2026

    @dotMorten
    Author

    Yes for default credential usage we'll be doing one more request to check if default credentials work (we did that upfront before but will just skip that). That's ok. For all other cases it'll be the same since we do already probe.

  21. wfurt commented on Jan 30, 2026

    @wfurt
    Member

    While DefaultCredentials will always do Negotiate, other creds may as well. But looking at the repose, you should be able to see the mechanisms.

  22. dotMorten commented on Jan 31, 2026

    @dotMorten
    Author

    This makes me wonder: If the policy is set to downgrade, and the version is 2.0 or greater, why can't the SocketsHttpHandler not just downgrade and do the retry for me?

  23. wfurt commented on Jan 31, 2026

    @wfurt
    Member

    it should but it does not do it. It is basically what the open issue wants to do.

  24. added
    enhancement
    and removed
    untriaged
    on Feb 10, 2026
  25. added this to the 11.0.0 milestone on Feb 10, 2026
  26. locked and limited conversation to collaborators on Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-System.Net.Httpenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions