My application is using the AD Authentication for Login using LDAP URL. All was fine until our SA told us to change the URL to LDAPS. Once I added the URL as LDAPS it throws an exception and does not allow users to Login. Please help me in this.
Working LDAP URL: LDAP://reg1.abc.com
LDAPS URL (NEW) : LDAPS://reg1.abc.com (Not working once changed)
Below is the code to Authenticate user through LDAP.
public static SearchResult AuthenticateUser(string userName, string password)
{
var directoryEntry = new DirectoryEntry(ConfigurationManager.AppSettings["ActiveDirectoryPath"], userName, password, AuthenticationTypes.Secure);
var directorySearcher = new DirectorySearcher(directoryEntry);
directorySearcher.Filter = "(samaccountname=" + userName + ")";
var result = directorySearcher.FindOne();
return result;
}