Running the following code with port 636 (secure) through a console application it works fine, however through a ASP.Net web site it fails:
DirectoryEntry authServer = new DirectoryEntry(@"LDAP://zxxx.cf.ac.uk:636", "", "", AuthenticationTypes.Anonymous);
DirectorySearcher directorySearch = new DirectorySearcher(authServer, "(CN=sissh6)");
SearchResult result = directorySearch.FindOne();
Here is the error:
Problem authenticating : System.Runtime.InteropServices.COMException (0x8007203A):
The server is not operational.
at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
at System.DirectoryServices.DirectoryEntry.Bind()
at System.DirectoryServices.DirectoryEntry.get_AdsObject()
at System.DirectoryServices.DirectorySearcher.FindAll(Boolean findMoreThanOne)
at System.DirectoryServices.DirectorySearcher.FindOne()
Now if we use non secure (no port 636) then the problem disappears, but the final solution must be secure.
Why would the secure version work through a console application but not through asp.net?