asp.net验证ad用户的方法
来源:互联网 发布:java 数据类型取值范围 编辑:程序博客网 时间:2024/05/01 09:30
1.要使用DirectoryEntry必须首先添加引用System.DirectoryServices
2.DirectoryEntry 类可封装 Active Directory 域服务层次结构中的节点或对象。 使用此类绑定到对象、读取属性和更新特性。
3.DirectoryEntry 与帮助器类一起为生存期管理和导航方法提供支持,包括创建、删除、重命名、移动子节点和枚举子级。
4.使用 DirectorySearcher 类可对 Active Directory 域服务层次结构执行查询。
5. LDAP 是系统提供的唯一一种支持搜索的 Active Directory 服务接口 (ADSI) 提供程序。
6.通过 DirectorySearcher 搜索 Active Directory 域服务层次结构将返回 SearchResult 的实例,这些实例包含在 SearchResultCollection类的实例中。
代码实例:
//验证ad中用户名和密码是否正确
//dotnet 4.0
//使用vs2010开发
public class AuthenticationADUser
{
//srvr = ldap server, e.g. LDAP://zsy.com
//usr = user name e.g. zhangsan
//pwd = user password e.g. 123
public bool IsAuthenticated(string srvr, string usr, string pwd)
{
bool authenticated = false;
try
{
DirectoryEntry entry = new DirectoryEntry(srvr, usr, pwd, AuthenticationTypes.Secure);
object nativeObject = entry.NativeObject;
authenticated = true;
}
catch (Exception ex)
{
//not authenticated due to some other exception [this is optional]
}
return authenticated;
}
}
- asp.net验证ad用户的方法
- asp.net用户注册时的验证
- asp.net用户注册时的验证
- asp.net用户注册时的验证
- ASP.Net用户验证的实现
- asp.net用户注册时的验证
- Asp.net读取AD域信息的方法<转>
- Asp.net读取AD域信息的方法
- VB.Net中使用LDAP验证基于微软AD的登录用户
- [NET]浅谈ASP.NET的权限管理和用户验证
- asp.net继承page类重写方法 实现最基本的用户登录验证 权限验证等
- asp.net继承page类重写方法 实现最基本的用户登录验证 权限验证等
- asp.net的登录验证方法
- [ASP.NET用户验证一]Forms验证
- asp.net用户自定义控件的方法
- asp.net操作AD的问题
- asp.net 中用户和角色的验证
- asp.net 中用户和角色的验证
- 图片翻转效果,用于变换图片
- system.img文件 解包/打包
- sprinh mvc 返回json格式数据
- 在Eclipse中使用全局搜索相关的java内容
- LeetCode OJ 之 Spiral Matrix II (螺旋矩阵 - 二)
- asp.net验证ad用户的方法
- HBase 系统架构图
- c# 读取xml文件 "分析 EntityName 时出错"的解决方案
- 大昭寺传说
- sql 值得学习的语句(个人总结)
- Hadoop常用命令
- Combination Sum II
- 【ArcGIS平台系列】ArcGIS平台,打造可落地的新一代Web GIS
- NSInvocation的使用