title: How do I authenticate user in ASP.NET Identity framework?
body: <p>I am using a default ASP.NET 4.5 framework's ASP.NET MVC 5 project template. It has identity authentication framework configured with it.</p>
  
  <p>I want to use Window's Active Directory with my project, so I followed this article - <a href="http://www.schiffhauer.com/mvc-5-and-active-directory-authentication/" rel="nofollow">http://www.schiffhauer.com/mvc-5-and-active-directory-authentication/</a></p>
  
  <p>And in my AccountController's login method I have</p>
  
  <pre><code>if (Membership.ValidateUser(model.Email, model.Password))
  {
      CustomFormsAuthentication.SetAuthenticationCookie(model.Email, model,  model.RememberMe);
      return RedirectToAction("Index", "Home");
  }
  </code></pre>
  
  <p>Where CustomFormsAuthentication class has</p>
  
  <pre><code>public static class CustomFormsAuthentication
  {
      public static void SetAuthenticationCookie(string username, object obj, bool isPersistent)
      {
          const int version = 1;
          var json = new JavaScriptSerializer().Serialize(obj);
          var cookieStoreTime = isPersistent ? DateTime.Now.AddDays(7): DateTime.Now.AddDays(1);
          var ticket = new FormsAuthenticationTicket(version, username, DateTime.Now, cookieStoreTime, isPersistent, json);
  
          HttpContext.Current.Response.Cookies.Set(new HttpCookie(FormsAuthentication.FormsCookieName,
              FormsAuthentication.Encrypt(ticket)) {Expires = cookieStoreTime});
      }
  }
  </code></pre>
  
  <p>But the user is never authenticated. The User.Identity.IsAuthenticated still shows false.</p>
  
  <p>How do I go about this ?</p>