I am using C# to authenticate users to my app as follows:
LdapConnection connection = null;
try
{
using (connection = new LdapConnection(Configuration.JonahLdapServer))
{
connection.Credential = new NetworkCredential(userName, password, Configuration.JonahDomain);
connection.AuthType = AuthType.Basic;
connection.SessionOptions.SecureSocketLayer = true;
connection.SessionOptions.VerifyServerCertificate =
new VerifyServerCertificateCallback(AlwaysTrustCertificateDelegate);
connection.Bind();
return true;
}
}
When I run this in VS 2008, it works just fine. However, when I deploy the application to IIS 5.1, it gives me the following stacktrace:
System.DirectoryServices.Protocols.LdapException: The LDAP server is unavailable. System.DirectoryServices.Protocols.LdapConnection.Connect() at System.DirectoryServices.Protocols.LdapConnection.BindHelper(NetworkCredential newCredential, Boolean needSetCredential) at System.DirectoryServices.Protocols.LdapConnection.Bind() at Jonahgroup.Lychee.Presentation.Security.SecurityManager.AuthenticateUser(String userName, String password)
It should be noted that if I run the code without SSL, it works fine on both IIS and VS.
Any help would be appreciated.