i"ve written code for Active directory LDAP user's authentication . It authenticates all users account in AD, But i want only Administrator account authentication not other user account(see below code). And also find domain name of connecting DNS(refer attached image).
try
{
DirectoryEntry entry = new DirectoryEntry(Domain, UserName, Password);
object nativeObject = entry.NativeObject;
Program.fileWrite.WriteLine(DateTime.Now + "\t Login with credentials " + UserName + " and " + Password);
return true;
}
catch (DirectoryServicesCOMException e)
{
Program.fileWrite.WriteLine(DateTime.Now + "\t " + e.Message);
return false;
}