Note that there are some explanatory texts on larger screens.

plurals
  1. POAuthenticate against a user in active directory?
    text
    copied!<p>I do have a web application where i have a login page.How do i authenticate against the active directory users ?</p> <p>As of now i am able to get some properties from the active directory,which concludes i am able to communicate with AD with LDAP string.I know its not possible to extract password from AD and authenticate against user entered password !!.</p> <p>Is there a way i can authenticate against the active directory users ?</p> <p>Here is my code so far</p> <pre><code> public class Userdetails { public static string ADPath = ConfigurationManager.AppSettings.Get(“ADPath”); // Get the ADAM Path from web config fiel public static string ADUser = ConfigurationManager.AppSettings.Get(“ADUser”); //ADAM Administrator public static string ADPassword = ConfigurationManager.AppSettings.Get(“ADPassword”); //ADAM Administrator password public static DirectoryEntry GetUserDetails(string userID) { AuthenticationTypes AuthTypes; // Authentication flags. // Set authentication flags. // For non-secure connection, use LDAP port and // ADS_USE_SIGNING | // ADS_USE_SEALING | // ADS_SECURE_AUTHENTICATION // For secure connection, use SSL port and // ADS_USE_SSL | ADS_SECURE_AUTHENTICATION AuthTypes = AuthenticationTypes.Signing | AuthenticationTypes.Sealing | AuthenticationTypes.Secure; DirectoryEntry De = new DirectoryEntry(ADPath, ADUser, ADPassword, AuthTypes); DirectorySearcher Ds = new DirectorySearcher(De); SearchResult Sr; Ds.SearchScope = SearchScope.Subtree; Ds.Filter = “(&amp;(objectclass=*)(cn= ” + userID + “))”; Sr = Ds.FindOne(); if (!(Sr == null)) { De = new DirectoryEntry(Sr.Path, ADUser, ADPassword, AuthTypes); return De; } else { return null; } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload