Not sure how you found FindByIdentity to work, since I thought you also needed to specify the type of authentication? i.e:
UserPrincipal up = UserPrincipal.FindByIdentity(ctx, IdentityType.SamAccountName, userName);
In any case, impersonation may work if you force it. So, before this piece of code, use the following:
// This will impersonate the logged in user in order to get whichever username you require GIVEN the logged in user has AD read/querying rights. System.Web.HttpContext.Current.Request.LogonUserIdentity.Impersonate(); using (PrincipalContext ctx = new PrincipalContext(ContextType.Domain)) { UserPrincipal up = UserPrincipal.FindByIdentity(ctx, userName); return up; }
source share