ActiveDirectoryMembershipProvider - "Unable to establish secure connection"

Pablo picture Pablo · Jul 22, 2009 · Viewed 25.5k times · Source

I am trying to configure an ActiveDirectoryMembershipProvider but I keep getting the message "Unable to establish secure connection with the server".

I have seen online at the MSDN website that I should configure the trust level to unrestricted on my site and I still get that.

Here is my example:

<connectionStrings>

     <add name="LocalAD" connectionString="LDAP://example.com/dc=example,dc=com" />

</connectionStrings>


<membership defaultProvider="AspNetActiveDirectoryMembershipProvider">

    <providers>

        <add name="AspNetActiveDirectoryMembershipProvider"
             type="System.Web.Security.ActiveDirectoryMembershipProvider" 
             applicationName="adtest"
             connectionUsername="cn=Users"
             connectionPassword="password"
             connectionStringName="LocalAD" >

       </add>
    </providers>
</membership>

<trust level="Full" />

<authentication mode="Forms">
      <forms loginUrl="login.aspx"
             protection="All"
             timeout="30"
             name="miBenefitsAdminToolCookie"
             path="/"
             requireSSL="false"
             slidingExpiration="true"
             defaultUrl="Default.aspx"
             cookieless="UseCookies"
             enableCrossAppRedirects="false" />

 </authentication>

 <authorization>
      <deny users="?" />
      <allow users="*" />
 </authorization>

Answer

tvanfosson picture tvanfosson · Jul 22, 2009

You're supplying what looks like a container instead of an actual user name to be used in making the connection to AD. Provide the canonical name of a user with sufficient credentials to access AD. Note that if the server is in the same domain, the Network System user that the worker process runs under may already have enough privileges and you won't need to provide a name/password at all.

    <add name="AspNetActiveDirectoryMembershipProvider"
         type="System.Web.Security.ActiveDirectoryMembershipProvider" 
         applicationName="adtest"
         connectionUsername="cn=actualUser"
         connectionPassword="actualUsersPassword"
         connectionStringName="LocalAD">

   </add>