title: HttpContext.User.Identity.IsAuthenticated never true
body: <p><strong>Login</strong></p>
  
  <pre><code>[HttpPost]
  public ActionResult Login(LoginModel loginModel)
  {
      if (ModelState.IsValid)
      {
          using (var _Db = new AccountContext())
          {
              var _UserAccount = _Db.UserAccounts.FirstOrDefault(u =&gt; u.Username == loginModel.Username &amp;&amp; u.Password == loginModel.Password);
  
              if (_UserAccount == null)
              {
                  ModelState.AddModelError("", "Account doesn't exist!");
              }
              else
              {
                  FormsAuthentication.SetAuthCookie(loginModel.Username, false);
              }
          }
      }
      return RedirectToAction("Index", "Home");
  }
  </code></pre>
  
  <p><strong>Redirect or display view</strong></p>
  
  <pre><code>public ActionResult Index()
  {
      if (HttpContext.User.Identity.IsAuthenticated)
      {
          return View("Index");
      }
      else
      {
          return RedirectToAction("LoginPage");
      }
  }
  </code></pre>
  
  <p>I've stepped through the code and can see the SetAuthCookie being called with the correct username.
  <code>FormsAuthentication.SetAuthCookie(loginModel.Username, false);</code></p>
  
  <p><strong>What could prevent the user from being authenticated?</strong></p>