Active Directory Problems...

Discussion in 'ASP .Net' started by =?Utf-8?B?VGltOjouLg==?=, Feb 7, 2005.

  1. Can someone please tell me why the following doesn't return any results! I
    don't get an error but at the same time I don't recieve any results from the
    AD????

    Would be really grateful for any advice!

    Thanks


    ...code..
    Sub SetupSession()
    Dim strUserName As String
    Dim strADPath As String

    strUserName = "netadmin" 'HttpContext.Current.User.Identity.Name
    strADPath = "domain.domain.com"

    Dim Entry As DirectoryEntry = New DirectoryEntry("LDAP://" &
    strADPath, "username", "xxxxxxxx")
    ' Create a DirectorySearcher object.
    Dim mySearcher As New DirectorySearcher(entry)
    ' Use the FindOne method to find the object, which in this case, is
    the user
    ' indicated by User Name and assign it to a SearchResult.
    Dim ResEnt As SearchResult = mySearcher.FindOne()
    ' Assign a property name to propKey.
    Dim propKey As String
    ' Assign a property name to propKey.
    For Each propKey In ResEnt.Properties.PropertyNames
    ' Assign the property value to prop.
    Dim prop As [Object]
    ' Assign the property value to prop.
    For Each prop In ResEnt.Properties(propKey)
    ' Handle results. Be aware that the following WriteLine
    ' only returns readable results for properties that are
    strings.
    Console.WriteLine("{0}:{1}", propKey, prop.ToString())
    Next prop
    Next propKey
    ' Add error handling.



    End Sub
    End Class
    =?Utf-8?B?VGltOjouLg==?=, Feb 7, 2005
    #1
    1. Advertising

  2. Patrick Olurotimi Ige, Feb 7, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jeremy Chapman
    Replies:
    0
    Views:
    378
    Jeremy Chapman
    Dec 1, 2003
  2. Carlettus
    Replies:
    1
    Views:
    302
    Peter Bradley
    Jun 14, 2007
  3. Paul East
    Replies:
    3
    Views:
    302
    Beginner
    Mar 2, 2004
  4. ejcosta
    Replies:
    2
    Views:
    868
    Eurico Costa
    Oct 8, 2004
  5. carlos seramos
    Replies:
    2
    Views:
    478
    carlos seramos
    Aug 1, 2003
Loading...

Share This Page