Run as active Directory accountRSS

3 replies

Last post Jun 12, 2019 08:25 PM by lextm

  • Run as active Directory account

    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.

    thanks

  • Re: Run as active Directory account

    Jun 11, 2019 09:58 PM|lextm|LINK

    Malachi611

    Context.User.Identity.Name.ToString

    That's a wrong way to get log on users. Use "Page.User" or "Controller.User".

    Lex Li
    IIS Consulting Services at https://support.lextudio.com/services/consulting.html
    ---------------------------
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: Run as active Directory account

    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

    System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString()

    this always returns the domain account name that the IIS website is running as, and not the windows authentication current user name.

    thanks

  • Re: Run as active Directory account

    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.

    Lex Li
    IIS Consulting Services at https://support.lextudio.com/services/consulting.html
    ---------------------------
    This posting is provided "AS IS" with no warranties, and confers no rights.