Click here to Skip to main content
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 2: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 OriginalGriff 6,649
1 Sergey Alexandrovich Kryukov 6,270
2 CPallini 5,190
3 George Jonsson 3,574
4 Gihan Liyanage 2,522


Advertise | Privacy | Mobile
Web01 | 2.8.140916.1 | Last Updated 16 Nov 2012
Copyright © CodeProject, 1999-2014
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