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

推荐订阅源

博客园_首页
MongoDB | Blog
MongoDB | Blog
Google DeepMind News
Google DeepMind News
M
MIT News - Artificial intelligence
D
Docker
云风的 BLOG
云风的 BLOG
B
Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
G
Google Developers Blog
GbyAI
GbyAI
T
Tailwind CSS Blog
罗磊的独立博客
博客园 - 三生石上(FineUI控件)
V
Visual Studio Blog
C
Check Point Blog
I
InfoQ
Microsoft Azure Blog
Microsoft Azure Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
阮一峰的网络日志
阮一峰的网络日志
小众软件
小众软件
N
Netflix TechBlog - Medium
B
Blog RSS Feed
腾讯CDC
aimingoo的专栏
aimingoo的专栏

博客园 - 沸石

快速压缩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;
}
}