I have integrated LDAP in ASP.NET Core razor pages using System.DirectoryServices.AccountManagement package.
System.DirectoryServices.AccountManagement
I followed the method they are using in this