学习:DirectoryEntry::Path 属性(winnt、LDAP、IIS)(转)
获取或设置此 DirectoryEntry 的路径。
命名空间:System.DirectoryServices
程序集:System.DirectoryServices(在 System.DirectoryServices.dll 中)
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ADMINI%7E1/LOCALS%7E1/Temp/msohtmlclip1/01/clip_image001.gif 语法
C#
public string Path { get; set; }
JScript
public function get Path () : String
public function set Path (value : String)
属性值
类型:System..::.String
此 DirectoryEntry 对象的路径。默认值为空字符串 ("")。
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ADMINI%7E1/LOCALS%7E1/Temp/msohtmlclip1/01/clip_image001.gif 备注
Path 属性唯一地标识网络环境中的此项。始终可以使用此 Path 检索此项。
设置 Path 将从目录存储区检索新项;它不更改当前绑定的项的路径。
与 DirectoryEntry 组件关联的类可与任何 Active Directory 域服务提供程序一起使用。当前的一些提供程序包括 Internet 信息服务 (IIS)、轻量目录访问协议 (LDAP)、Novell NetWare 目录服务 (NDS) 和 WinNT。
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ADMINI%7E1/LOCALS%7E1/Temp/msohtmlclip1/01/clip_image002.gif说明:
标识提供程序(在“://”前面)的 Path 部分是区分大小写的。例如,“LDAP://”或“WinNT://”。
Path 属性的语法随提供程序不同而不同。一些常见的情况有:
WinNT
· 连接到计算机上的组。例如“WinNT://<域名>/<计算机名>/<组名>”。如果是连接到本地计算机,则为“WinNT://<计算机名>/<组名>”。
· 连接到计算机上的用户。例如“WinNT://<域名>/<计算机名>/<用户名>”。如果是连接到本地计算机,则为“WinNT://<计算机名>/<用户名>”。
· 连接到计算机上的服务。例如“WinNT://<域名>/<计算机名>/<服务名>”。如果是连接到本地计算机,则为“WinNT://<计算机名>/<服务名>”。
· 发现网络上的所有域。例如,“WinNT:”通过枚举此项的子级可以找到这些域。
LDAP
· 连接到域中的组。例如“LDAP://CN=<组名>, CN =<用户>, DC=<域组件>, DC=<域组件>,...”。
· 连接到域中的用户。例如“LDAP://CN=<完整用户名>, CN=<用户>, DC=<域组件>, DC=<域组件>,...”。
· 连接到域中的计算机。例如“LDAP://CN=<计算机名>, CN=<计算机>, DC=<域组件>, DC=<域组件>,...”。
IIS
· 连接到 Web 目录。例如“IIS://LocalHost/W3SVC/1/ROOT/<Web 目录名>”。
若要使用 LDAP 绑定到当前域,请使用路径“LDAP://RootDSE”,然后获取默认命名上下文,并重新绑定该项。例如:
C#
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ADMINI%7E1/LOCALS%7E1/Temp/msohtmlclip1/01/clip_image003.gif复制代码
String str = ent.Properties["defaultNamingContext"];
DirectoryEntry domain = new DirectoryEntry("LDAP://" + str);
有关更多信息,请参见提供程序文档和位于 http://msdn.microsoft.com/library 上的 MSDN Library 中的主题 Using Active Directory Serv(使用 Active Directory 服务)。
http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME%7E1/ADMINI%7E1/LOCALS%7E1/Temp/msohtmlclip1/01/clip_image001.gif
页:
[1]