Guest User

Untitled

a guest
Sep 3rd, 2018
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. DirectoryServices - “Network logon failure unknown user name or bad password”
  2. //Example 1: Find all users in Active Directory. Be sure your LDAP connection string is correct.
  3. string ldapConnection = @"LDAP://sergio-j9i2vccv/dc=contoso,dc=com";
  4. string username = "Administrador"; //I'm using a spanish version of WS2003.
  5. string password = String.Empty;
  6.  
  7. UserFinder userSearcher = new UserFinder(ldapConnection, username, password);
  8. try
  9. {
  10. var users = userSearcher.FindAllUsers();
  11.  
  12. foreach (var user in users)
  13. {
  14. Console.WriteLine(user.Name);
  15. Console.WriteLine(user.Path);
  16. }
  17. }
  18. catch (Exception e)
  19. {
  20. Console.WriteLine(e.Message);
  21. }
Add Comment
Please, Sign In to add comment