I have looked for some threads in this forum but they are not giving any clear solutions to my problem.
I am trying to do a simple authentication thrpugh an LDAP server in my university. however the code returns an exception saying that "the server is not operational".
public bool IsAuthenticated(string username, string password)
{
DirectoryEntry dir = new DirectoryEntry("LDAP://servername/ou=People,o=university.edu",username,password,AuthenticationTypes.SecureSocketsLayer);
try
{
using (DirectorySearcher search = new DirectorySearcher(dir))
{
search.ServerTimeLimit = new TimeSpan(0, 0, 5);
search.ClientTimeout = new TimeSpan(0, 0, 5);
SearchResult result = search.FindOne();
}
}
catch
{
return false;
}
return true;
}
any ideas??