看看vs.net的文档 System.DirectoryServicesusing System;
using System.Management;
using System.DirectoryServices;
using System.Net;
class Security
{ static void Main (string[] args)
{
DirectoryEntry entry = new DirectoryEntry("LDAP://domain/DC=domain,DC=com");
foreach(DirectoryEntry objChildDE in entry.Children)
{
if ( objChildDE.SchemaClassName == "User")
{
Console.WriteLine(objChildDE.Path) ;
}
}
}
}
这段程序可以显示 域中的用户!
using System.Management;
using System.DirectoryServices;
using System.Net;
class Security
{ static void Main (string[] args)
{
DirectoryEntry entry = new DirectoryEntry("LDAP://domain/DC=domain,DC=com");
foreach(DirectoryEntry objChildDE in entry.Children)
{
if ( objChildDE.SchemaClassName == "User")
{
Console.WriteLine(objChildDE.Path) ;
}
}
}
}
这段程序可以显示 域中的用户!
解决方案 »
- 急,求助,C# socket服务端接收并解析客户端发送的http请求
- 求一正则表达式(字符串中是否存在大括号,中括号,单引号,双引号({}[]'")等六个特殊字符,且字字符串长度不超过20个字符,要求调用Regex.IsMatch返回false)
- 【求助】~~~消息队列接收不到消息~
- 求时间进度条代码
- 压缩文件夹及子文件夹????????
- 一个一直想解决但总是解决不了的问题,请教下高手!!!
- 转义字符在实际中的应用
- sqlserver修改密码的问题
- 打印问题
- 程序移植
- 如何用C#写串口程序
- 使用csc.exe 编译出现error cs0246:找不到类型或命名空间名称“system”(是否缺少using 指令或程序集引用?)
但是,不知道在web form里能不能用
using System.DirectoryServices;
可不可以解释一下"LDAP://domain/DC=domain,DC=com"
不同系统都有自己的 目录服务(Internet Information Services (IIS),Novell NetWare Directory Service (NDS), NT4是WinNT://)。到了2000的ActiveDirectory就用LDAP,当然2000也兼容WinNT。
他们都符合ADSI System Providers 这个接口。既然是目录,就有路径。LDAP://domain/DC=domain,DC=com 就是一个域的路径
new DirectoryEntry("LDAP://domain/DC=domain,DC=com");通过DirectoeyEntry的构造函数得到这个路径的对象,然后进行操作。(domain就是你的域名,com就是一般的.com)LDAP的格式,非常非常复杂,我也不太清楚。一般只对域、工作组、用户操作!
LDAP://DomainName/CN=UserName,CN=Users,DC=DomainName,DC=com 这是一个用户的路径具体请参考vs.net的document。或到news://msnews.microsoft.com上去问!
因为使用ldap时,会用到windows验证,可能会出现超时无法操作的错误(可能是我那里服务器的问题)