title: Membership credential verification failed
body: <p>I'm encountering this error : Membership credential verification failed. when I try to login with Active Directory user in an ASP.NET aplication using form based authentication.</p>
  
  <p>I have a complex set-up as follow:</p>
  
  <p>I'm using an Active Directory Lightweight Directory Services (Ad LDS), aka ADAM as a membership repository.
  I binded it to an Active Directory with proxy users and completed an adamsync.
  I configured an SSL certificate for the AD LDS.
  While connected to the AD LDS with LDP.exe, i'm able to connect/bind with both AD LDS users or AD users, so the proxy is ok. 
  My ASP.NET application talk to the AD LDS, an i'm able to successfully login with AD LDS users using forms based authentication.</p>
  
  <p>But i'm unable to login with my AD users with the ASP.NET application, what am i missing out ?</p>
  
  <p>Heres my Provider Section from my web.config :</p>
  
  <pre><code>&lt;add name="MyADConnectionString"
       connectionString="LDAP://localhost/OU=Users,DC=PreuveConcept,DC=local" /&gt;
  
  &lt;authentication mode="Forms"&gt;
    &lt;forms loginUrl="~/Account/LogOn" timeout="2880" /&gt;
  &lt;/authentication&gt;
  
  &lt;membership defaultProvider="AspNetActiveDirectoryMembershipProvider"&gt;
    &lt;providers&gt;
      &lt;clear/&gt;
      &lt;add name="AspNetActiveDirectoryMembershipProvider" 
           type="System.Web.Security.ActiveDirectoryMembershipProvider" 
           connectionStringName="MyADConnectionString" 
           connectionProtection="Secure" 
           enableSearchMethods="true"/&gt;
    &lt;/providers&gt;
  &lt;/membership&gt;
  </code></pre>
  
  <p>Heres my login action (Default MVC AcountControler) :</p>
  
  <pre><code>    [HttpPost]
      public ActionResult LogOn(LogOnModel model, string returnUrl)
      {
          if (ModelState.IsValid)
          {
              if (Membership.ValidateUser(model.UserName, model.Password))
              {
                  FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe);
                  if (Url.IsLocalUrl(returnUrl) &amp;&amp; returnUrl.Length &gt; 1 &amp;&amp; returnUrl.StartsWith("/")
                      &amp;&amp; !returnUrl.StartsWith("//") &amp;&amp; !returnUrl.StartsWith("/\\"))
                  {
                      return Redirect(returnUrl);
                  }
                  else
                  {
                      return RedirectToAction("Index", "Home");
                  }
              }
              else
              {
                  ModelState.AddModelError("", "The user name or password provided is incorrect.");
              }
          }
  
          // If we got this far, something failed, redisplay form
          return View(model);
      }
  </code></pre>