-1

We are building "ASP.net Web API" to communicate between external database on-promise and SharePoint-online. We have already got Active Directory, which would be the security base of this API. I have done several attempts to implement the Active Directory Authorization and Authentication to this API. Even I tried with console application for test only. However, no success yet.

 using (DirectoryEntry dEntry = new DirectoryEntry("LDAP://" + domainName, userName, password))
            {
                DirectorySearcher dSearcher = new DirectorySearcher(dEntry)
                {
                    Filter = "(&(objectClass=user)(mail=" + userName + "))"
                };
                SearchResult sResult = dSearcher.FindOne();
             }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.