Hi all,
does anybody know how to query Active Directory for users? At the moment I
am able to get the login and the role of the user who is accesing the page.
I would also like to get the first name, the last name and the
e-mail-address. So far I've been using the following code:
<%@ Page language="c#" debug="True" %>
<% @ Import Namespace = System.Security.Principal %>
<% @ Import Namespace = System.Threading %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
<script language="C#" runat=server>
void Page_Load(Object Src, EventArgs E )
{
WindowsPrincipal Principal = (WindowsPrincipal) User;
WindowsIdentity Identity = (WindowsIdentity) User.Identity;
AuthUser.Text = Identity.Name;
AuthType.Text = Identity.AuthenticationType;
AuthTrueFalse.Text = Identity.IsAuthenticated.ToString();
AuthAdmin.Text
Principal.IsInRole(WindowsBuiltInRole.Administrator).ToString();
}
</script>
.
.
.
Kind regards,
Frank Tichy