(Turn) http://msdn.microsoft.com/library/default.asp? Url =/library/en-US/ADSI/iadsuser. asp
To bind to a domain user through a winnt provider, use the domain name as part of the adspath, as shown in the following code example.
GetObject ("winnt: // mydomain/jeffsmith, user ")
Similarly, use the computer name as part of the adspath to bind to a local user.
GetObject ("winnt: // mycomputer/jeffsmith, user ")
In Active Directory, domain users reside in the directory. The following code example shows how to bind to a domain user through an LDAP provider.
GetObject ("LDAP: // Cn = Jeff Smith, ou = Sales, Dc = fabrikam, Dc = com ")
However, local accounts reside in the local SAM Database and the LDAP provider does not communicate with the local database. thus, to bind to a local user, you must go through a winnt provider as described in the second code example.
Example:
// Bind the domain and change the user password.
Direcotryentry entry = new directoryentry ("winnt: // devtest/josson", "josson", "pass");
// Bind LDAP
// New directoryentry ("LDAP: // devtest/CN = Jin, Cn = users, Dc = devtest, Dc = com", "josson", "pass");
Entry. invork ("changepassword", new object [] {oldpassword, newpassword });