By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,498 Members | 1,564 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,498 IT Pros & Developers. It's quick & easy.

Getting a users domain from the active directory

P: n/a
I have an application where the client wants AD integration. The application requires that the user accounts reside in
the app's database. The application is a (.NET) webservices based app where the desktop client polls a webservice to
return info to the user. The client wants to only manage accounts via the AD. So if they create a new AD user then the
app should automatically create a user in the app database. This is not such a problem as I can write an application to
run as a service that scans the AD and creates new accounts in the app database. Then using the authenticated user info
from the the web service I can get the user name within the domain (using the WindowsIdentity class). The problem is
that the name property of the WindowsIdentity class returns the domain qualified name i.e. "domainname/username". This
is good as it provides a unique identifier since there cannot be a duplicate name within a domain. The difficulty is
that I don't really see a way to get the domain of a user from the AD. There appear to be properties that have the
domain name buried in the distinguished name but I've seen some somewhat complicated AD hierarchies where that isn't
available. So, my question is how can, my AD polling app get the domain/username info from the AD so that I can create
the proper account in my app db?

BTW, I'm using the LDAP protocol when accessing the AD using the DirectoryServices namespace. I don't know if the WinNT
protocol has more descriptive info but I couldn't get that protocol to work anyway. Also, if anyone know how to use the
DirectorySearcher class to search for the objectID

TIA

--Buddy
Jul 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.