I have an intranet site built in MVC6 using ASP.NET Core RC2. I want to get the name of the Windows user accessing the intranet site.
So, if Jim goes to the intranet site, I want the site to get "Domain \ Jim", and if Ann goes to the intranet site, I want the site to get "Domain \ Anne".
On my IIS server, only Windows authentication is enabled, anonymous authentication is disabled.
My site is configured to use Windows Authentication and disable Anonymous Authentication.
<system.web> <authentication mode="Windows" /> <authorization> <deny users="?"/> </authorization> </system.web>
Through Debug, I can use System.Security.Principal.WindowsIdentity.GetCurrent().Name , but of course returns "IIS APPPOOL \ SiteName" on the IIS server.
I found many examples from an old version of ASP.NET using HttpContext, and I tried to inject this into my controller with the following, but the username ends in null.
What is the correct way to transfer a Windows username to an intranet site in ASP.NET Core RC2 MVC6?
source share