asp.net-mvcasp.net-mvc-4authenticationiisapplicationpoolidentity

How to get Window user Identity? "User.Identity.Name" returning App Pool Identity instead of Windows User


I have a MVC 4 application deployed on IIS. I am trying to get the Windows user in code as following but its reuring me the App Pool user.

Code Inside Controller to get User:

User.Identity.Name

I have tried to chaged the App pool Identity to Local System, NetworkSystem and ApplicationPoolIdentity. But then it stoped returing anything back.

What I am looking for it that I don't want Login prompt screen to be displayed when user hit the site, site should autometically pick the System user and display the results accordingly.

config is as below:

<authentication mode="None"/>

Thanks in Advance


Solution

  • Change in Application pool worked for me.

    Changed Load User Settings to true in application pool advanced settings and it worked.