Click here to Skip to main content
15,881,516 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
VB
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
Comments
Abhijit Dan 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900