using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.DirectoryServices.AccountManagement;
namespace MyConsoleApplication
{
class Program
{
static void Main(string[] args)
{
// create a "principal context" - e.g. your domain (could be machine, too)
using (PrincipalContext pc = new PrincipalContext(ContextType.Domain, "contoso"))
{
// validate the credentials
bool isValid = pc.ValidateCredentials("brianc", "pass@word1");
Console.WriteLine(isValid.ToString());
Console.ReadLine();
}
}
}
}
0 comments:
Post a Comment