In C#, how do I authenticate a user on a network machine? For example, I want to authenticate the user testuser
with password testpassword
on the machine EXAMPLEMACHINE
from a different machine which is network-connected to EXAMPLEMACHINE
. For example, I am on MYMACHINE
and I want to authenticate testuser
with testpassword
on EXAMPLEMACHINE
.
I have tried the following but it keeps telling me that, The LDAP server is unavailable:
PrincipalContext context =
new PrincipalContext(ContextType.Domain, exampleMachineDomain);
return context.ValidateCredentials(username, password);