DirectorySearcher: Problem with receiving Account Name (the slash maybe the reason)

  • Thread starter Thread starter Robin Bully
  • Start date Start date
R

Robin Bully

Hi!

I do have a problem while retrieving the AccountName of Members of a Active
Directory-Group.

I get the members with the DirectorySearcher (of the
System.DirectoryServices namespace).
It all works well with member-entries like:
"CN=blablabla,OU=Users,OU=xxx,OU=xx,DC=xx,DC=xxxxxx,DC=com"
or
"CN=lastname,firstname info&X
moreinfo-A,OU=Users,OU=xxx,OU=xx,DC=xx,DC=xxxxxxx,DC=com"

but not with:

"CN=lastname,firstname xxx/xxx
moreinfo-B,OU=Users,OU=bib,OU=xx,DC=xx,DC=xxxxxxx,DC=com"

I suppose the slash between "xxx/xxx" produces the error.

I this a bug, any ideas? I can not change the AD-entries for the users....

thanks in advance
 
I do have a problem while retrieving the AccountName of Members of a Active
Directory-Group.
but not with:
"CN=lastname,firstname xxx/xxx
moreinfo-B,OU=Users,OU=bib,OU=xx,DC=xx,DC=xxxxxxx,DC=com"

How does it "not work"? Is that user not being returned as a member?
Does it produce an error?
I suppose the slash between "xxx/xxx" produces the error.

Yes, that's the problem - since / and , are separators in LDAP paths,
you cannot use them in object names. Those and a few more. Many of
those special characters (like ; # and so on) can be "escaped" by
preceding them with a backslash ( \ ), but we never got the forward
slash to work properly. AVOID IT ! That's your best bet.

Marc
================================================================
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)inova.ch
 
How does it "not work"? Is that user not being returned as a member?
Does it produce an error?

It produces an Error with ErrorCode -2147463168, which is an unknown error!

The slashes are currently used in the AD-entries an it works, but the
directorysearcher does not handle them.

Thank you.
 
How does it "not work"? Is that user not being returned as a member?
It produces an Error with ErrorCode -2147463168, which is an unknown error!

When does this error occur exactly? What's the code that causes the
error?
The slashes are currently used in the AD-entries an it works, but the
directorysearcher does not handle them.

That's rather odd - can you try and bind to one of those users
explicitly, using a DirectoryEntry?

Something like:

DirectoryEntry deUser = new
DirectoryEntry("LDAP://"CN=lastname,firstname xxx\/xxx
moreinfo-B,OU=Users,OU=bib,OU=xx,DC=xx,DC=xxxxxxx,DC=com");

NOTE the backslash infront of the forward slash in the user name!

Does this work? Can you get this user's info?

Marc
================================================================
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)inova.ch
 
Thank you very much, this works!
Seems that the ',' in the User name has been masked with the backslash
automatically, but the '/' not!

But anyway, in my opinion this is a bug in the directory searcher class!
 
Back
Top