[Personal Work] LDAP has been released successfully

Source: Internet
Author: User
This is why I tried again a year and a half ago.

Development Environment: Window XP
Development Tool: Visual stutio 2003 (later use visual stutio 2005 to re-upload the code)
Opening statement: VB. NET
Development Time: January

Starting from the source region

Rows

Program description

Private sub button#click () sub button#click (byval sender as system. Object, byval e as system. eventargs) handles button1.click
Dim domain as string = me. textbox1.text
Dim username as string = me. textbox2.text
Dim password as string = me. textbox3.text

Try
Dim ad as new system. directoryservices. directoryentry ("LDAP: //" & domain, username, password)
St + = AD. Name & vbcrlf
Showad (AD, 0)
Catch ex as exception
MessageBox. Show ("loading into zookeeper or cannot fetch ad ")
Exit sub
End try
MessageBox. Show ("zookeeper normal" + vbcrlf + st)
Application. Exit ()
End sub
Sub showad () sub showad (byval ad as system. directoryservices. directoryentry, byval level as integer)
For each adchildren as system. directoryservices. directoryentry in AD. Children
If me. combobox1.selectedindex =-1 then
St & = Microsoft. VisualBasic. Strings. strdup (level, "-") & adchildren. Name & ";" & adchildren. schemaclassname & vbcrlf
If me. checkbox1.checked = true then
For each itemname as string in adchildren. properties. propertynames
For each items as object in adchildren. properties (itemname)
St & = Microsoft. VisualBasic. Strings. strdup (LEVEL + 1, "-") & itemname &":"
Try
St & = items & vbcrlf
Catch ex as exception
St & = "unable to connect" & vbcrlf
End try
Next
Next
End if
Elseif adchildren. schemaclassname = me. combobox1.selecteditem then
St & = Microsoft. VisualBasic. Strings. strdup (level, "-") & adchildren. Name & ";" & adchildren. schemaclassname & vbcrlf
If me. checkbox1.checked = true then
For each itemname as string in adchildren. properties. propertynames
For each items as object in adchildren. properties (itemname)
St & = Microsoft. VisualBasic. Strings. strdup (LEVEL + 1, "-") & itemname &":"
Try
St & = items & vbcrlf
Catch ex as exception
St & = "unable to connect" & vbcrlf
End try
Next
Next
End if
End if

Showad (adchildren, level + 1)
Next
End sub

. NET and LDAP (Protocol 1) Use System. directoryservices. directoryentry
The format of the constructor is as follows:
Dim ad as new system. directoryservices. directoryentry ("LDAP: //" & domain, username, password)
Call showad to retrieve the sub-vertex information after the connection is normal.

Brief one LDAP (Lightweight Directory Access Protocol) Protocol

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.