This code gets me properties of an AD user in our organization, specifically the user that the web site is running as, a service account (so the results are the same no matter what user is running the web site):
DirectoryEntry entry = UserPrincipal.Current.GetUnderlyingObject() as DirectoryEntry;
if (entry != null)
{
foreach (string name in entry.Properties.PropertyNames)
{
Response.Write(entry.Properties[name].Value.ToString() + "</br>");
}
}
However, what I need is to get those properties for the user who is running the web browser. I would think I could get those from HttpContext, but can't find that principal or a GetUnderlyingObject() method that way.
How do I get that same list of AD properties for the user who is logged into the Windows machine and running the web browser?