get the username and domain (domain\user) in ASP.Net c# RRS feed

  • Question

  • User-2052909100 posted

    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 .

    Tuesday, April 26, 2016 7:27 AM


  • User-2057865890 posted

    Hi Tommy,

    By default, ASP.NET impersonation is disabled. If you enable impersonation, your ASP.NET application runs under the security context of the user authenticated.

    Windows Authentication in IIS, impersonation on

    Getting A Users Username in ASP.NET

    Best Regards,


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, April 27, 2016 3:05 AM

All replies