Getting a users domain from the active directory
From: Buddy Ackerman (buddy_nospam_at_buddyackerman.com)
Date: 03/15/05
- Next message: Top Hat: "ASP worker process not releasing files"
- Previous message: Alien2_51: "RE: Atomic FileSystem operations"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 15 Mar 2005 17:01:09 -0600
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
- Next message: Top Hat: "ASP worker process not releasing files"
- Previous message: Alien2_51: "RE: Atomic FileSystem operations"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|