惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

IT之家
IT之家
aimingoo的专栏
aimingoo的专栏
H
Help Net Security
L
LangChain Blog
M
MIT News - Artificial intelligence
The GitHub Blog
The GitHub Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
C
Check Point Blog
P
Proofpoint News Feed
J
Java Code Geeks
大猫的无限游戏
大猫的无限游戏
博客园_首页
Blog — PlanetScale
Blog — PlanetScale
U
Unit 42
I
InfoQ
月光博客
月光博客
爱范儿
爱范儿
Stack Overflow Blog
Stack Overflow Blog
V
Visual Studio Blog
Y
Y Combinator Blog
Microsoft Security Blog
Microsoft Security Blog
博客园 - Franky
D
Docker
B
Blog

博客园 - 沸石

快速压缩log文件 SQL Server-拆分字符串返回表(存储过程) ASHX 生成excel文件 SQL Server-动态Pivot表的存储过程 突破AD查询1000条限制(转) 轻松创建运行命令 (转) (转)Resolving errors creating a Strong Name Key 以动词开头的习惯搭配:转 枚举的遍历和字符串转枚举,枚举转字符串 转 - 沸石 - 博客园 (转)英语信件中最常用精选句式 控件命名 转:C#委托及事件 转:关于HttpHandlers和HttpModules的不同 js:scrollLeft,scrollWidth,clientWidth,offsetWidth完全详解 商业书信英语-常用结束语 SQL中合并多行记录的方法总汇 C# 中的字符串函数及应用举例(转) 英文函电书写基本原则 SQL Server 2005之PIVOT/UNPIVOT行列转换
转:YetAnotherForum集成AD用户混合登录(一) AD验证类 - 沸石...
沸石 · 2009-04-10 · via 博客园 - 沸石

YetAnotherForum集成AD用户混合登录(一) AD验证类

 public class AD_pass
{
private string _path;
private string _filterAttribute;
public AD_pass()
{

_path

= "LDAP://DC=office,DC=local";

}

public bool IsAuthenticated(string username, string pwd)
{

try
{
DirectoryEntry entry

= new DirectoryEntry(_path, username, pwd);

Object obj

= entry.NativeObject;
DirectorySearcher search
= new DirectorySearcher(entry);
search.Filter
= "(SAMAccountName=" + username + ")";
SearchResult result
= search.FindOne();
if (null == result)
{
return false;
}
_path
= result.Path;
_filterAttribute
= (String)result.Properties["cn"][0];
}
catch (Exception ex)
{
return false;
}
return true;
}
}