0

i have website in (asp.net c#) and i have login page in this login page i need to use two way to login

  1. by check (review) current windows login name (i need to get username and domain (domain\user)) if not found this user in my DB . go to second way.
  2. normal login (by enter username and password).

i have problem when i get the username and domain (domain\user) when i use (Security.Principal.WindowsIdentity.GetCurrent().Name the output is IIS APPPOOL/DefultPool)

Note : My website work under Internet Information Services

I want To get domain\user for any user open my website

Thanks .

1 Answers1

0

While running on LocalHost you need to set the Identity for your ApplicationPool to your Windows credentials. Open IIS Manager and navigate to your Application Pools. From here you need to change the identity of the Application Pool that your web app is running on.

IIS Application Poools

Right click on the Application Pool and go to Advanced Settings.

Advanced Settings

Click the ellipses and change the credentials to your custom account.

Note: This does not automatically update when your credentials change (Ex. Password Change)

Matt Rowland
  • 4,575
  • 4
  • 25
  • 34
  • thanks Matt Rowland. but I want To get domain\user for any user open my website – Tommy Jone May 02 '16 at 04:58
  • @TommyJone The code that you have mentioned (but not shown) should get the session user when it is on the server. The settings I have posted are for debugging on your local box. – Matt Rowland May 02 '16 at 11:35