学海无涯

记录我的程序人生...

  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
  73 随笔 :: 2 文章 :: 67 评论 :: 11 引用

(转)http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adsi/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:
//绑定域,修改用户密码.
DirecotryEntry entry = new DirectoryEntry(“WinNT://DEVTEST/Josson“,“Josson“,“pass“);
//LDAP绑定
//new DirectoryEntry(“LDAP://DEVTEST/CN=jin,CN=Users,DC=devtest,DC=com“,“Josson“,“pass“);

entry.Invork(“ChangePassword“,new object[]{oldPassword,newPassword});

posted on 2004-09-09 13:57 josson 阅读(452) 评论(0)  编辑 收藏 网摘 所属分类: 其他的



发表评论

昵称: [登录] [注册]

主页:

邮箱:(仅博主可见)

评论内容:

  登录  注册

[使用Ctrl+Enter键快速提交评论]

0 41396




相关文章:

相关链接: