User properties from Active Directory

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • SamuelVimes
    New Member
    • Mar 2009
    • 1

    User properties from Active Directory

    Hello All,

    Can anyone help me with this. I'm trying to create an ASP/VB .NET website that validates the user using active directory. I also need to pull the user's description. The validation works fine, but I can't get the description property back.

    Here's my code :-

    Dim Success As Boolean = False
    Dim myEntry As New System.Director yServices.Direc toryEntry("LDAP ://" & domainName, userName, password)
    Dim mySearch As New System.Director yServices.Direc torySearcher(my Entry)
    mySearch.Search Scope = DirectoryServic es.SearchScope. Subtree
    mySearch.Proper tiesToLoad.Add( "Descriptio n")
    Try
    Dim mySearchResult As System.Director yServices.Searc hResult = mySearch.FindOn e
    Dim userDesc As String = mySearchResult. Properties("Des cription").ToSt ring
    Success = True
    Catch
    Success = False
    End Try

    If anyone can tell me where I'm going wrong I'd really appreciate it!
Working...