问题
using framework asp.net core - on .net core MVC jquery
In the account controller, I am attempting to obtain the user currently logged in to that machine on an intranet network. ie the windows authenticated user.
If I try WindowsIdentity.GetCurrent()
is just returns the identity of the application pool. not what I need.
I have anonymous turned off and windows auth turned on in both the launchsettings.json
and the IIS settings.
I understand that the identity middleware for abp framework I'm using is table based so the Controllers 'User'
property is not what I need either.
I am wondering whether this is a limitation of the .net core?
回答1:
You need to disable Anonymous Authentication and enable Windows Authentication for a specific page like Login page. This way, you say the Login page requires NTLM. So browser sends authenticated user information. And you can retrieve it with HttpContext.User.Identity.Name
Then there's next challenge! Authenticating this user with ABP. For this one, you can check out this StackOverflow post.
来源:https://stackoverflow.com/questions/49545771/trying-to-obtain-the-windows-identity-of-the-logged-on-user-in-accountcontroller