I've successfully used System.DirectoryServices
in .NET Core 3.1, example:
var de = new DirectoryEntry("LDAP://DC=mydc,DC=example,DC=com", "myusername", "mypass");
var ds = new DirectorySearcher(de)
{
Filter = $"(&(objectClass=user)(sn=john)(givenName=jim))"
};
ds.Asynchronous = true;
var fndUser = ds.FindOne();
The problem I have is that it does not truly apply async and even if I run it in Task.Run, it is a blocking method (DirectorySearcher Asynchronous using await)
I have tried looking for examples using System.DirectoryServices.Protocol but it's still not clear for me - if anyone can provide a guide or example that would be great as it is a little overwhelming. Would a 3rd party library like Ldap4Net or Novell.Directory.Ldap.NETStandard a more suitable path? I am weak on this subject (async and threads) and would really appreciate advice - many thanks.