title: Umbraco not authenticating against Active Directory
body: <p>I'm creating an internet site for the follow configuration:
   - public website
   - users need to authenticate agains active directory
   - roles are servered by an 3th party ERP system, also using AD for authentication</p>
  
  <p><strong>What I have done</strong>
  So I tried to follow this guide (<a href="https://our.umbraco.org/wiki/how-tos/membership-providers/active-directory-membership-provider" rel="nofollow">https://our.umbraco.org/wiki/how-tos/membership-providers/active-directory-membership-provider</a>) for the authentication, and wrote a custsom role provider for the ERP roles. I used the built in template for the login form.</p>
  
  <p><em>The role part works just fine. The authentication does not.</em></p>
  
  <p><strong>The problem</strong>
  It seems that Umbraco is still using the UmbracoMembershipProvider. When I create a member in umbraco I can login with the umbraco credentials. When I try any AD accounts it won't authenticate. </p>
  
  <p><strong>I tried to</strong>
  Change the LDAP connectionstring to use a non existing OU or CN. It gives me errors, so connection to AD is made somewhere in the proces.</p>
  
  <p>I also tried RB.ActiveDirectoryProviders. Same result.</p>
  
  <p>I don't get any exception thrown, just "Invalid username or password". The logs say:</p>
  
  <pre><code>2015-08-19 08:45:20,764 [126] INFO  Umbraco.Core.Security.UmbracoMembershipProviderBase - [P6460/T133/D8] Login attempt failed for username nico from IP address ::1, the user does not exist
  </code></pre>
  
  <p>My best guess I made some configuration error.</p>
  
  <p>So how do I use Active Directory as only MembershipProvider?</p>
  
  <p>Any help is welcome.</p>
  
  <p><strong>My setup</strong>:</p>
  
  <p>local box with iis/umbraco/VS2012 running a virtual PC with the AD. I run Umbraco 7.2.8 in Visual Studio/IISExpress. I used the Nuget package of Umbraco.</p>
  
  <p>web.config
  <div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;connectionStrings&gt;
     &lt;add name="ADConnectionString" connectionString="LDAP://192.168.2.50/dc=XXX,dc=YYY" /&gt;
  &lt;/connectionStrings&gt; 
  
  &lt;membership defaultProvider="ADMembershipProvider" userIsOnlineTimeWindow="15"&gt;
    &lt;providers&gt;
      &lt;clear /&gt;
      &lt;add name="UmbracoMembershipProvider" type="Umbraco.Web.Security.Providers.MembersMembershipProvider, Umbraco" minRequiredNonalphanumericCharacters="0" minRequiredPasswordLength="4" useLegacyEncoding="true" enablePasswordRetrieval="false" enablePasswordReset="true"
      requiresQuestionAndAnswer="false" defaultMemberTypeAlias="Member" passwordFormat="Hashed" /&gt;
      &lt;add name="UsersMembershipProvider" type="Umbraco.Web.Security.Providers.UsersMembershipProvider, Umbraco" minRequiredNonalphanumericCharacters="0" minRequiredPasswordLength="4" useLegacyEncoding="true" enablePasswordRetrieval="false" enablePasswordReset="true"
      requiresQuestionAndAnswer="false" passwordFormat="Hashed" /&gt;
      &lt;add name="ADMembershipProvider" type="System.Web.Security.ActiveDirectoryMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="ADConnectionString" connectionUsername="[USER]" connectionPassword="[PASSWORD]"
      attributeMapUsername="sAMAccountName" /&gt;
    &lt;/providers&gt;
  &lt;/membership&gt;
  
  
  
  
  @using (Html.BeginUmbracoForm&lt;UmbLoginController&gt;("HandleLogin"))
  {
      &lt;fieldset&gt;
          &lt;legend&gt;Login&lt;/legend&gt;
          
          @Html.ValidationSummary("loginModel", true)
  
          @Html.LabelFor(m =&gt; loginModel.Username)
          @Html.TextBoxFor(m =&gt; loginModel.Username)
          @Html.ValidationMessageFor(m =&gt; loginModel.Username)
          &lt;br /&gt;
  
          @Html.LabelFor(m =&gt; loginModel.Password)
          @Html.PasswordFor(m =&gt; loginModel.Password)
          @Html.ValidationMessageFor(m =&gt; loginModel.Password)
          &lt;br /&gt;
  
          &lt;button&gt;Login&lt;/button&gt;
      &lt;/fieldset&gt;  
  }</code></pre>
  </div>
  </div>
  </p>