Getting a users domain from the active directory

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Buddy Ackerman (buddy_nospam_at_buddyackerman.com)
Date: 03/15/05


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



Relevant Pages

  • Re: Error 3197 but there are no memo fields
    ... That sounds more like your app doing ... My client is actually fine with the concept of patches etc, ... I've got the Error 3197 problem ("The Microsoft Jet database ...
    (comp.databases.ms-access)
  • Re: soft code
    ... Exactly how static does an app have to be to be "hard coded"? ... to be set in the database. ... allow users to create and/or adjust interfaces into various systems. ... without the client needing a new application. ...
    (borland.public.delphi.language.objectpascal)
  • Re: soft code
    ... I had looked on the internet for an explanation but could not find ... > app might use an n-tiered approach and allow rules for validating data ... > to be set in the database. ... > without the client needing a new application. ...
    (borland.public.delphi.language.objectpascal)
  • Re: Convert Access application to .NET?
    ... I am learning as I go and the client does not want to ... I had assumed that the instability came from the UI, not the database. ... do you know how Crystal Reports compares to the reports in Access. ... We decided to convert the whole app to .Net. ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: SMS site server HDD allocation
    ... > system roles will be placed, where the SQL database will be, etc. ... > The Client Installation Wizard is used to remotely install, or push, the ... > If you are, and you should be, using Advanced Security, all the SMS 2003 ... > Connection accounts to allow the clients to connect and write to the ...
    (microsoft.public.sms.admin)