2009-07-16 84 views

回答

1

创建DirectoryEntry不会做的比实际创建更记忆中的对象。 DirectoryEntry对象实际上只是一个托管包装,基于COM的基于COM的ADSI (Active Directory Service Interfaces)接口的基本IADsObject(可以 - 如果您真的想要 - 也可以直接使用)。

只有当您开始使用其属性或访问底层的.NativeObject COM对象时,它是否会实际连接到Active Directory,使用当前凭据(或您提供的任何备用凭据)登录,然后尝试并获取来自AD的该DirectoryEntry的信息。

Marc

0

从我可以看到使用反射器,它采用了activds.dll

例如:

[DllImport("activeds.dll", EntryPoint="ADsOpenObject", CharSet=CharSet.Unicode, ExactSpelling=true)] 
private static extern int IntADsOpenObject(string path, string userName, string password, int flags, [In, Out] ref Guid iid, [MarshalAs(UnmanagedType.Interface)] out object ppObject); 

http://msdn.microsoft.com/en-us/library/aa772238(VS.85).aspx

相关问题