0

I know my Account Username and password. I am able to login to any PC on the domain.

Console.WriteLine("User Name: " + userName + " Password: " + tb.Text.ToString().Trim());
System.DirectoryServices.AccountManagement.PrincipalContext pc = new System.DirectoryServices.AccountManagement.PrincipalContext(ContextType.Domain, "DOMAIN.TLD");                

// validate the credentials 
bool validatedOnDomain = pc.ValidateCredentials(userName, tb.Text.ToString().Trim());
return validatedOnDomain;

This method keeps returning false.

Am I doing something wrong here? I also know what my password is. Any assitance would be great!

tb -> TextBox where the password is being inputted. I remove all white spaces and trimmed it (in case a user screws up)

JPBlanc
  • 70,406
  • 17
  • 130
  • 175
Cocoa Dev
  • 9,361
  • 31
  • 109
  • 177
  • There are quite a few other questions on here (and elsewhere on the internet) that deal with `PrincipalContext.ValidateCredentials` unexpectedly returning false. Have you looked at those? – Chris Farmer Feb 15 '12 at 16:51

1 Answers1

1

Can you try this :

bool validatedOnDomain = pc.ValidateCredentials(userName, tb.Text.ToString().Trim(), ContextOptions.Negotiate); 

You just have to Specifie the options that are used for binding to the server.

JPBlanc
  • 70,406
  • 17
  • 130
  • 175