G
Guest
Greetings,
I am writing an Intranet application in ASP.NET using VB.NET. I am
obtaining the username of the user with:
uName = User.Identity.Name, which is in the form of DOMAIN\username. I then
use substring to parse out just the username.
What I am trying to accomplish is getting the full name of the user by doing
a search in Active Directory, but I am failing at every turn. This code:
Dim de As DirectoryEntry
de = New DirectoryEntry("LDAP://Bestia/CN=" + uName) Bestia is the
name of our domain controller)
Dim ds As DirectorySearcher
ds = New DirectorySearcher(de)
Dim rs As SearchResult = ds.FindOne()
Returns this error:
[COMException (0x80072020): An operations error occurred]
This code:
Dim de As DirectoryEntry
de = New DirectoryEntry("LDAP://Bestia/CN=" + uName +
",DC=mainoffice") (mainoffice is the name of our domain)
Dim ds As DirectorySearcher
ds = New DirectorySearcher(de)
Returns this error:
[COMException (0x8007202b): A referral was returned from the server]
I'm new at doing this sort of coding and it seems like it should be a fairly
simple thing to do, but I can't get it to work. Can anybody help with this
problem? Also, if anybody knows of a simpler way to do this, I'm all ears.
Thanks in advance!
Mike
I am writing an Intranet application in ASP.NET using VB.NET. I am
obtaining the username of the user with:
uName = User.Identity.Name, which is in the form of DOMAIN\username. I then
use substring to parse out just the username.
What I am trying to accomplish is getting the full name of the user by doing
a search in Active Directory, but I am failing at every turn. This code:
Dim de As DirectoryEntry
de = New DirectoryEntry("LDAP://Bestia/CN=" + uName) Bestia is the
name of our domain controller)
Dim ds As DirectorySearcher
ds = New DirectorySearcher(de)
Dim rs As SearchResult = ds.FindOne()
Returns this error:
[COMException (0x80072020): An operations error occurred]
This code:
Dim de As DirectoryEntry
de = New DirectoryEntry("LDAP://Bestia/CN=" + uName +
",DC=mainoffice") (mainoffice is the name of our domain)
Dim ds As DirectorySearcher
ds = New DirectorySearcher(de)
Returns this error:
[COMException (0x8007202b): A referral was returned from the server]
I'm new at doing this sort of coding and it seems like it should be a fairly
simple thing to do, but I can't get it to work. Can anybody help with this
problem? Also, if anybody knows of a simpler way to do this, I'm all ears.
Thanks in advance!
Mike