Sunday, March 29, 2015

Unable to establish secure connection with the server

I was recently working on using Forms Authentication with Active Directory when I suddenly received the following error message:






Unable to establish secure connection with the server

I double checked my connectivity to the server and everything looked OK to me.  However, the computer that I was testing with was not connected to the target Domain.

Was there any workaround other than joining my workstation to the same Domain as the Active Directory server?

Well, as it turns out there is!

You can simply add the following setting to the Active Directory membership provider configuration in the Web.config file:

<membership defaultProvider="ADMembershipProvider">
  <providers>
    <clear />
    <add name="ADMembershipProvider" type="System.Web.Security.ActiveDirectoryMembershipProvider" connectionStringName="ADConnectionString" attributeMapUsername="sAMAccountName" connectionUsername="mydomain\domainuser" connectionPassword="domainPassword!"  />
  </providers>
</membership>

Then, you may have to switch the LDAP/Active Directory connection string to the following:

 



<connectionStrings>
<add name="ADConnectionString" connectionString="LDAP://10.10.10.1:389/DC=mydomain,DC=com"  />
</connectionStrings>

 

After doing this, I was able to connect successfully to the Domain even when my computer/workstation was not joined to the Domain!


1 comment: