safi malete

safi malete

  • NA
  • 5
  • 0

Newbie ..... Active Directory + VB .Net

Oct 28 2008 8:02 AM

Hi All.

I want to check if my Connection was successfull to the AD. I know my problem is getting the value of "de.Path".

Please assist

See code below

Code

{

Public Shared Function GetDirectoryEntry() As DirectoryEntry

Dim de As DirectoryEntry = New DirectoryEntry()

'Connect to my server

de.Path = "LDAP://SERVER/OU=Groups;DC=MY DOMAIN;"

'login Details

de.Username = "DOMAIN\USERNAME"

de.Password = "PASSWORD"

de.AuthenticationType = AuthenticationTypes.Secure

Return de

End Function

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim de As DirectoryEntry = New DirectoryEntry()

'Checking if Connection Is being Established

If de.Equals(0) Then

MessageBox.Show("Not Connected.....")

Else

MessageBox.Show("Connected......")

End If

End Sub

End Class

}