我在使用Net2.0对AD编程取用户信息的时候发生了一个百思不得其解的问题,对以下的代码:
string m_strRoot="LDAP://192.168.24.12/CN=users,DC=vs-mail,DC=com"
m_obDirEntry = new DirectoryEntry(strRoot);
m_obDirEntry = GetDirectoryObject();
SearchResultCollection results;
   DirectorySearcher srch = new DirectorySearcher(m_obDirEntry);
      srch.Filter = "(&(&(objectCategory=person)(objectClass=user))(sAMAccountName="+strLogin+"))";
           //srch.SearchScope = SearchScope.Subtree;
     results = srch.FindAll();

 private static DirectoryEntry GetDirectoryObject()
        {
            DirectoryEntry entry = new DirectoryEntry("LDAP://192.168.24.12/CN=users,DC=vs-mail,DC=com", "administrator", "Admin@1",         AuthenticationTypes.Secure);
            return entry;
        }

当我红色底字的代码而不用绿色底字的代码只能在 file system 的web程序上运行成功,但真正放到生产中的web上就取不出用户数据
但我绿色底字的代码而不用红色底字的代码则在什么环境都行,我不知道到底是怎么回事?有高手能帮助解答一下吗?
                                    
  

相关文章:

  • 2022-12-23
  • 2022-02-05
  • 2021-08-02
  • 2022-12-23
  • 2021-09-26
  • 2021-09-10
  • 2022-12-23
  • 2021-06-19
猜你喜欢
  • 2022-12-23
  • 2021-10-16
  • 2022-01-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-24
  • 2022-01-21
相关资源
相似解决方案