0
votes

I am building an ASP.NET MVC intranet app for my organization and want to get the network user name. I have the following in my Web.config

<system.web>
     <authentication mode="Windows"> </authentication>
     <authorization>
        <allow users="*"/>
        <deny users="?"/>
     </authorization>

When I am debugging with IIS Express, Request.LogonUserIdentity.Name gives my windows username.

However, when in deploy my app on IIS, Request.LogonUserIdentity.Name is coming as "NT AUTHORITY\IUSR" instead of the windows username.

In IIS, for my app, I have enabled just Windows Authentication and disabled other types of authentication.

What change do I need to make in IIS so that Request.LogonUserIdentity.Name gives the logged in windows username?

1
What happens if you remove the allow element?Khyron

1 Answers

-3
votes

Find any guide from Microsoft at Google, and they will tell you that you forgot to enable Windows authentication on IIS and disable anonymous authentication.