public static bool Authenticate(string domain, string username, string password)
{
bool bAuth = false;
DirectoryEntry entry = null;
try {
entry = new DirectoryEntry(string.Concat(@"LDAP://", domain), username, password);
object nativeObject = entry.NativeObject;
bAuth = true;
} catch (Exception) {
bAuth = false;
} finally {
entry.Close();
entry.Dispose();
}
return bAuth;
}