Hi guys,
I have the following scenario. One ActiveDirectory server and one PC in the domain. From this PC I'm starting the following code:
LdapConnection connection = null;
try {
LdapDirectoryIdentifier identifier = new LdapDirectoryIdentifier(ad
Server, true, false);
NetworkCredential credential = new NetworkCredential(username
, password);
using (connection = new LdapConnection(identifier,
credential, AuthType.Basic)) {
connection.Bind(credential
);
Console.WriteLine(connecti
on.Session
Options.Ho
stReachabl
e);
}
} catch (Exception ex) {
Console.WriteLine(ex);
}
The problem I have: If I use as 'password' either an active password or a password that was previously active, connection.SessionOptions.
HostReacha
ble returns always true. After some time (or restart, I'm not sure) after first call with the invalid password - I get false. Then after if I call the ldap with valid (active) password the original (problem) behavior come again.
I think that this is some kind of cache. I've tried all properties of LdapConnection, LdapConnection.SessionOpti
ons but I'm not able to connect to the AD only with the active(valid) password.
Do you know how I can fix this problem?
Thanks
Start Free Trial