Problems to access Active Directory in VB.NET..

SpiXener

Beta member
Messages
2
Hi everybody,
I've been searching for days to find a way to access Active directory database from my VB.NET appz and nothing made good results so far.. The Active directory DB is located onto a Win2k3 server but we have another on a NT4 server too.. Neither worked.. First, I was having a "Server not operational" error message, but fixed it in putting more parameters into the DirectoryEntry creation string. But now, I always get a "A referral was returned from the server(0x8007202B)" error message.. I tried to change as many things I could, but it still bugs me.. Any Idea?!??
Here's the source:
===================================================
Code:
Dim oRoot As DirectoryEntry = New DirectoryEntry("LDAP://" & Me.mServer & ":389/DC=Dynanet,DC=com", "test", "test", AuthenticationTypes.Secure)[/color]
[color=blue]Dim oSearcher As DirectorySearcher = New DirectorySearcher(oRoot)
Dim oResult As SearchResult[/color]
[color=blue]Try[/color]
[color=blue][QUOTE] 'it bugz at this line, right on the For declaration [/QUOTE] 
For Each oResult In oSearcher.FindAll[/color]
[color=blue]If Not CStr(oResult.GetDirectoryEntry().Properties("cn").Value) = "" Then
Dim User As New LDAPUser(CStr(oResult.GetDirectoryEntry().Properties("uid").Value), _
CStr(oResult.GetDirectoryEntry().Properties("givenName").Value), _
CStr(oResult.GetDirectoryEntry().Properties("desc").Value), _
CStr(oResult.GetDirectoryEntry().Properties("email").Value), _
CStr(oResult.GetDirectoryEntry().Properties("phone").Value), _
CStr(oResult.GetDirectoryEntry().Properties("sms").Value))
Me.Ha****ems.Add(User.userId, User)
Me.LisItems.Add(User)[/color]
[color=blue]End If[/color]
[color=blue]Next oResult
Catch ex As Exception
MsgBox(ex.ToString)
Finally
oRoot = Nothing
oSearcher = Nothing
oResult = Nothing
End Try
==================================================
Thanks all!
 
I already looked on Google, MSDN and everything else.. But they only tell me that "A referral return from the server" correspond to LDAP error Code LDAP_REFERRAL without telling how to fix the issue I have..

Anybody has a concrete idea?

Thanks in advance!
 
Back
Top Bottom