title: MVC Forms authentication - IsAuthenticated is false after login and true while redirecting explicitly
body: <p>I have the following methods responsible for login authentication:</p>
  
  <pre><code> [HttpPost]
      [AllowAnonymous]
      [ValidateAntiForgeryToken]
      public ActionResult Login(LoginModel loginModel, string returnUrl)
      {
          if (ModelState.IsValid)
          {
              //if (Membership.ValidateUser(loginModel.UserName, loginModel.Password))
              var session = RMWebClientBL.Sessions.Login(loginModel.UserName, loginModel.Password);
              if(session != null &amp;&amp; !session.IsFailed &amp;&amp; session.SessionId != Guid.Empty)
              {
                  SetAuthCookie(loginModel, session);
                  RedirectToLocal(returnUrl);
              }
              else
              {
                  ModelState.AddModelError("", "The user name or password provided is incorrect.");
              }
          }
  
          // If we got this far, something failed, redisplay form
          return View();
      }
  
      private void SetAuthCookie(LoginModel loginModel, DomainObjects.Sessions.SessionDetails session)
      {
          // create encryption cookie         
          FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(1,
                  loginModel.UserName,
                  DateTime.Now,
                  //TODO: make it configurable!!!!
                  DateTime.Now.AddMinutes(20),
                  loginModel.RememberMe,
                  session.SessionId.ToString());
  
          // add cookie to response stream         
          string encryptedTicket = FormsAuthentication.Encrypt(authTicket);
          System.Web.HttpCookie authCookie = new System.Web.HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
          if (authTicket.IsPersistent)
          {
              authCookie.Expires = authTicket.Expiration;
          }
          System.Web.HttpContext.Current.Response.Cookies.Add(authCookie);  
      }
  
      private ActionResult RedirectToLocal(string returnUrl)
      {
          if (Url.IsLocalUrl(returnUrl))
          {
  
             return Redirect(returnUrl);
          }
          else
          {
              return RedirectToAction("Index", "Home");
          }
      }
  </code></pre>
  
  <p>However when i am trying to login "User.Identity.IsAuthenticated" is still false after setting the cookie, BUT it seems that i am logged in because if i am clikcing on our logo which redirects me to the Homepage i am authenticated.
  why i am not being able to redirect after logging in?</p>