Avatar of Member_2_1242703
Member_2_1242703
 asked on

Help configuring .NET 4/MVC 5/IIS 8/2012 R2 site

I have a .NET 4 MVC 5 site set up in IIS 8.5 on a Windows Server 2012 R2 box like this:

Has it's own app pool running under service account
Anonymous Auth: enabled / using App Pool Identity
ASP.NET Impersonation enabled / using service account (also tried with Auth user)
Basic/Forms/Windows disabled

Everything works fine, except I need to get the user (NT) logon of the client user.

Using something like
System.Security.Principal.WindowsIdentity.GetCurrent().Name

Open in new window

Returns the aforementioned system account.

What code changes or changes to my configuration do I need to make to accomplish what I'm trying to do?
Windows Server 2012Microsoft IIS Web Server.NET MVC

Avatar of undefined
Last Comment
Member_2_1242703

8/22/2022 - Mon
Shaun Vermaak

You need to turn on Integrated Windows Authentication
if (System.Web.HttpContext.Current.User.Identity.IsAuthenticated)
{
string userName = System.Web.HttpContext.Current.User.Identity.Name;
}

Open in new window

Member_2_1242703

ASKER
Done. All of the other settings are the same.

Still getting the same result.
Shaun Vermaak

On client-side add site to Intranet sites and test
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Member_2_1242703

ASKER
Not sure what you mean. Like in the browser settings?
Shaun Vermaak

Yes, integrated authentication requires Intranet/Trusted Site AFAIK
Member_2_1242703

ASKER
Gotcha. Ok that's not going to work. Surely there is a better way? It's that integrated setting that is getting me too. Did this no problem with a classic pipeline.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Shaun Vermaak

Forms based authentication
Member_2_1242703

ASKER
I'll keep playing around with it. Thanks.
ASKER CERTIFIED SOLUTION
Member_2_1242703

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Member_2_1242703

ASKER
Figured it out
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23