views:

62

answers:

3

hi! I want to verify that given username/password pair is a valid windows vista account using c#.

A: 

You could use a PInvoke to LogonUser or, alternatively, use System.Diagnostics.Process to start a new process with a specified username/password and see if it succeeds.

Zooba
A: 

Maybe the System.Security namespace could help you

+1  A: 
// create a "principal context" - e.g. your domain (could be machine, too)
PrincipalContext pc = new PrincipalContext(ContextType.Domain, "YOURDOMAIN");

// validate the credentials
bool isValid = pc.ValidateCredentials("myuser", "mypassword")

Easy peasy

Nick Brooks