Click here to Skip to main content
11,415,390 members (81,550 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
 
        Dim de As New DirectoryEntry("LDAP://192.168.60.146/dc=esnlab,dc=local")
 
        de.AuthenticationType = AuthenticationTypes.None
        de.Username = "esnlab.local\administrator"
        de.Password = "admin@123"
 
        Try
            Dim ds As New DirectorySearcher(de)
 
            Dim mySearchResultColl As SearchResultCollection
 
            Dim mySearchResult As SearchResult
 
            mySearchResultColl = ds.FindAll
 
            Dim result As SearchResult = ds.FindOne()
            Dim counter As Integer = 0
            For Each mySearchResult In mySearchResultColl
 
                counter = counter + 1
 
                Response.Write(mySearchResult.GetDirectoryEntry().Properties("cn").Value)
                Response.Write(mySearchResult.GetDirectoryEntry().Properties("telephonenumber").Value)
                Response.Write("<br>")
            Next
            Response.Write(counter)
 
        Catch ex As Exception
            Response.Write("Bind Failed: " + ex.Message)
 
        End Try
Posted 16-Nov-12 3:02am
Comments
Abhijit Dan at 19-Nov-12 1:20am
   
If there was any mistake I did,I beg apology for that and i am extremely sorry.

ya I have also tried with
"
de.Username = administrator
de.Password = admin@123
"
and I spelled it correctly,I have checked it.

Although I am not able to solve the problem. Is there any other solution ? Help me please,please.......

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 9,270
1 OriginalGriff 7,512
2 Maciej Los 3,710
3 Abhinav S 3,325
4 Peter Leow 3,084


Advertise | Privacy | Mobile
Web01 | 2.8.150427.4 | Last Updated 16 Nov 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100