using System.DirectoryServices;

  DirectoryEntry dirEntry = new DirectoryEntry();
                    dirEntry.Path = "LDAP://IP/DC=;DC=;DC=;DC=";
                    dirEntry.Username = txtUser.Text;
                    dirEntry.Password = txtPassword.Text;
                    dirEntry.AuthenticationType = AuthenticationTypes.Secure;
                    DirectorySearcher search = new DirectorySearcher(dirEntry);
                    search.Filter = "(&(objectClass=user)(User=" + txtUser.Text + "))";
                    search.PropertiesToLoad.Add("SAMAccountName");
                    search.SearchScope = SearchScope.Subtree;
                    SearchResult result = search.FindOne();
                    using (SearchResultCollection results = search.FindAll())
                    {session["User"]=""; Response.Redirct();}

 

相关文章:

  • 2021-11-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-28
  • 2021-10-10
  • 2021-12-10
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-13
  • 2021-11-18
  • 2021-06-04
  • 2022-12-23
  • 2021-07-06
  • 2021-09-14
相关资源
相似解决方案