Base solution for your next web application
Open Closed

Windows Authentication - how do I get the user? #11376


User avatar
0
enio created

Our aspnetzero version: 11.3.0

Since several days I am now struggling with getting windows authentication to work. The problem I currently have is that my user is not set in:

HttpContext.User.Identity?.Name

The User object is set, but it is empty.

As described here - I have registered the authentication scheme in startup.cs:

services.AddAuthentication(NegotiateDefaults.AuthenticationScheme).AddNegotiate();

But unfortunately the user on HttpContext remains empty. I am pretty sure that I have setup IIS correctly - because I have built a very simple demo asp.net 6.0 project which works just fine and loads the user provided with windows authentication.

Therefore I have to guess that somehow the authentication configuration that I provided is overwritten by aspnetzero. Could that be possible?


1 Answer(s)
  • User Avatar
    0
    m.aliozkaya created
    Support Team

    Hi @enio

    Could you check this question? https://support.aspnetzero.com/QA/Questions/701/Add-windows-authentication-support