0

I'm trying to use the following code to get the local logged in user for my web application based on AD.

Here is what i'm trying;

string CurrentUser = WindowsIdentity.GetCurrent().Name;

            PrincipalContext context = new PrincipalContext(ContextType.Domain, "isd"); 
            UserPrincipal upUser = UserPrincipal.FindByIdentity(context, CurrentUser); 
            if(upUser != null) 
            { 

            }

However, it returns "IIS APPPOOL\DefaultAppPool" as the user and not isd\whoever

It's IIS7 and .net 4

Thanks

MissCoder87
  • 2,669
  • 10
  • 47
  • 82
  • Check out this link => http://stackoverflow.com/questions/11131228/how-to-get-current-windows-user-in-wcf – gleng Oct 28 '13 at 13:03
  • @gleng Thanks for that - but that will always return me wont it? Multiple users will be using this and I want to do different things depending on who's logged in to AD. – MissCoder87 Oct 28 '13 at 13:06

0 Answers0