IIS 7 and Above
Run as active Directory account
Last post Jun 12, 2019 08:25 PM by lextm
Jun 11, 2019 08:53 PM|Malachi611|LINK
we have been using local user accounts on our local IIS web servers, but for a few sites we have had to use an Active Directory account, but now when we use Context.User.Identity.Name.ToString to log the user that is on the site, we always get the name of
the Active Directory user that the site is running as.
how can we fix this, and we need the active directory account as it has permissions to access a network share that the local account doesn't.
Jun 11, 2019 09:58 PM|lextm|LINK
That's a wrong way to get log on users. Use "Page.User" or "Controller.User".
Jun 12, 2019 08:03 PM|Malachi611|LINK
that didn't work, this is an older web forms app. so Controller.User isn't available, and page.user returned something like "system.principle.user"
i have also tried
this always returns the domain account name that the IIS website is running as, and not the windows authentication current user name.
Jun 12, 2019 08:25 PM|lextm|LINK
For WebForms, Page.User is the only thing you can/should use. You don't need a WindowsIdentity object either.