There are multiple ways, but the way I've done it before is like this (using DirectoryEntry), it goes like this:
string ldapConnectionString = @"LDAP://[domain_server]/CN=Users,DC=[domain]"
using (var de = new DirectoryEntry(
ldapConnectionString, "username", "password",
AuthenticationTypes.Secure))
{
return de.NativeObject != null; // if not null -> user is valid
}
Edit: What this code will do is, validate a combination of a username/password against active directory. I think I misunderstood you (if what you mean is, to see if a user CAN connect to a particular server -> as in HAS PERMISSION to, I'm not quite sure how to do that, or even if it's possible).