I need to check the existence of a username/password in Active Directory,
without the workstation actually being in the domain. I'm using the
following C# code:
DirectoryEntry de = new
DirectoryEntry("ldap://dc.acadiau.ca/dc=ad,dc=acadiau,dc=ca", username,
password, AuthenticationTypes.Secure);
try
{
string name = de.Name;
MessageBox.Show("Username is valid")
}
catch
{
MessageBox.Show("Username is not valid")
}
The de.Name statement always fails. If I don't use the try/catch, I get an
unhandled exception error of type
"System.Runtime.InteropServices.COMException occurred in
system.directoryservices.dll" The additional information field states:
"Unknown error (0x80005000)".
I've seen similar examples indicating this is the way to do it, but I've hit
a road block. Anyone with any ideas?