ASP.NET如何读取Active Directory中的用户名和口令.

解决方案 »

  1.   

    试试这个:
    取得用户名的:  User.Identity.Name  ,密码不知道.
      

  2.   

    public bool CheckDomainUser(string UserName,string UserPassword)
    {
    try
    {
    string  path = System.Configuration.ConfigurationSettings.AppSettings["DomainString"];     
    string strUserName = UserName + "@greatwall.com.cn";
    if(path == "")
    {

    path = "GC://DC=xxx,DC=com,DC=cn";
    }
    DirectoryEntry dir   = new DirectoryEntry(path,strUserName,UserPassword);
     
    int intCount = dir.Properties.Count;     
    }
    catch
    {
    return false;
    }
    return true;
    }
    这是一个校验域用户及密码的函数