C# LDAP multi-NT-domain lookup code
June 11, 2003
Here is a little bit of C# code I wrote that allows LDAP authentication to take place without providing a fully qualified user name… this may be highly implementation specific but I thought someone could use it.
It first maps an unqualified NT username to a fully-qualified NT username (by connecting anonymously to an ActiveDirectory global catalog). It then extracts the distinguished name of the user and parses it to extract the correct domain. This domain is then concatenated with the domain and an authentication request is issued.
update: I have since discovered that there a few bugs in the code… But, I have a new and improved version that I will upload if there is enough demand.
Entry Filed under: programming. .
3 Comments Add your own
Leave a Comment
Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>





1.
Error... | July 30, 2003 at 5:00 am
I tried to copy your file to the orginal code that M$ done… (and made a backup of the orginal)
I also did the ldap connection that worked on my orginal code… in your code!
Now i cant compile it i get the following error:
Internal Compiler Error (0xc0000005 at address 5315C743): likely culprit is ‘BEGIN’.
An internal error has occurred in the compiler. To work around this problem, try simplifying or changing the program near the locations listed below. Locations at the top of the list are closer to the point at which the internal error occurred.
Must I modify something more in the orginal code?
2.
nathan jacobs | July 30, 2003 at 9:04 am
I have never seen this error but I did a little google search ( search terms = “Internal Compiler Error likely culprit is ‘BEGIN’”) and found the following:
http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/Q_20551621.html
http://lists.ximian.com/archives/public/mono-list/2001-September/001460.html
http://weblogs.asp.net/Rosherove/posts/3191.aspx
http://www.dotnet247.com/247reference/msgs/6/30556.aspx
> Must I modify something more in the orginal code?
It looks like you should try to following (in this order):
1) Cut and paste the code into a new file. And recompile.
2) Restart VS.NET. And recompile.
3) Use a standard distribution.
Good luck.
3.
Error... | August 1, 2003 at 5:10 am
Thx for your help now i get some other errors instead…
The type or namespace name ‘LdapAuthentication’ could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name ‘adAuth’ could not be found (are you missing a using directive or an assembly reference?)