While trying to create something as simple as a forms authentication mechanism with as Active Directory provider, I came accros a nice set of problems.
The main issue had to do with the actual connection to the active directory itself.
All done by the book and still no connection. How do you deal with this? Forget debug… you have to go lower.
I started by using ADSIEDIT, a tool that comes with ADAM. With this tool, you can connect and navigate a remote active directory. It worked, no problem, so there was no network problem. Opening a command prompt in the domain controller machine and executing the netstat -a command, I could see my machine connecting to the LDAP port.
After that I tried to run my web aplication and.. no deal. No ports oppening, no nothing.
I then added the following lines of code in the .cs file in order to try to undernstand if the connection was established:
string appName = Membership.ApplicationName;
An exception is then thrown with the text
“System.Configuration.ConfigurationErrorsException was unhandled by user code
Message=”Unable to establish secure connection with the server (C:\\bla\\bla\\WebSites\\DevelopmentWebsite\\web.config line 117)”
BareMessage=”Unable to establish secure connection with the server“
at System.Web.Configuration.ProvidersHelper.InstantiateProvider(ProviderSettings providerSettings, Type providerType)
at System.Web.Configuration.ProvidersHelper.InstantiateProviders(ProviderSettingsCollection configProviders, ProviderCollection providers, Type providerType)
at _Default.Logon_Click(Object sender, EventArgs e) in c:\bla\bla\WebSites\DevelopmentWebsite\Login.aspx.cs:line 39
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
By the time I got knocking my head against the walls, I found this information: How to enable LDAP over SSL with a third-party certification authority
That was it… It solved my problem.
Here are a couple of good information on this topic. Hope they help you. They helped me