C# 如何进行LDAP用户校验?

匿名网友 匿名网友 发布于: 2015-08-30 00:00:00
阅读 111 收藏 0 点赞 0 评论 0

示例代码如下:

private bool Authenticate(string userName, string password, string domain)

{

bool authentic = false;

try

{

DirectoryEntry entry = new DirectoryEntry(“LDAP://”+domain, userName, password);

object nativeObject = entry.NativeObject;

authentic = true;

}

catch (DirectoryServicesCOMException) { }

return authentic;

}

评论列表
文章目录