Viewing source for Recipe2003cs.aspx

<%@ Page language="c#" %>
<script runat="server">
private void Page_Load( System.object sender, System.EventArgs e) base.Load { 
//Put user code to initialize the page here //Note that this is getting a pre 
filtered result for the desired User System.DirectoryServices.DirectoryEntry 
User = new System.DirectoryServices.DirectoryEntry("LDAP://CN=Username, CN= 
users, DC=DomainName"); try { string value; value = 
User.Properties("HomeNumber").Item(0); //Now that value contains the value of 
that property you can use it however you see fit. //Note also that each 
property might contain more then one value depending on the property //That is 
why we used a zero above in item to get the first value. } catch (GAIS) { 
//Show error message } finally { User.Close(); } }
</script>