title: MVC 5 with owin cookie middleware - owinContext.Authentication.sign in not issuing cookies
body: <p>I am using MVC 5.2 and am trying to get the Owin cookie middleware working.</p>
  
  <p>In my login controller i do the following:</p>
  
  <pre><code>public class LoginController
  {
  
  [AllowAnonymous]
  public ActionResult Login(LoginViewModel loginViewModel)
      {
  
   //authenticate
       ....
  
          var claims = new List&lt;Claim&gt;
                           {
                               new Claim(ClaimTypes.Name, "abc"),
                               new Claim(ClaimTypes.Email, "abc@abc.com")
                           };
          var id = new ClaimsIdentity(claims, DefaultAuthenticationTypes.ApplicationCookie);
  
          var ctx = Request.GetOwinContext();
  
          var authenticationManager = ctx.Authentication;
  
          //create the cookie - i thought
  
          authenticationManager.SignIn(new AuthenticationProperties{IsPersistent = true}, id);
  
  
          //redirect to protected action
          return RedirectToAction("Index", "RoutingController");
  
    }
  
  
  [Authorize]
  public class RoutingController : Controller
  {
      [HttpGet]
      public ActionResult Index()
      {
          return this.View();
      }
  }
  </code></pre>
  
  <p>I have the following middleware wired up</p>
  
  <pre><code>   public void Configuration(IAppBuilder app)
      {           
  
          app.UseCookieAuthentication(
              new CookieAuthenticationOptions
                  {
                      AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                      LoginPath = new PathString("/Login/Login"),
                      CookieSecure = CookieSecureOption.Always
                  });
      }
  </code></pre>
  
  <p>Here is what happens</p>
  
  <ol>
  <li>Get /Login/Login</li>
  <li>Redirect to Routing/Index </li>
  <li>Redirec to Login/Login</li>
  </ol>
  
  <p>permanent 302 loop...</p>
  
  <p>What am i missing?</p>
  
  <p>Thanks</p>