
索引请点击这里
.NET与AD相结合,比较常用的有一种情况——用户登录验证。本章节就是用来说明一下验证输入凭证正确与否的方法。网络上流传较广的是如下方法:
DirectoryEntry entry = null;
try
{
entry = new DirectoryEntry(strLDAP, strUserName, strOldPwd, AuthenticationTypes.Secure);
object objID = entry.NativeGuid;
}
catch
{
this.lbError.Text = "输入的用户名或密码不正确";
...