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
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)