ASP.NET_SessionId + OWIN Cookies do not send to browser

后端 未结 9 1362
误落风尘
误落风尘 2020-11-22 14:00

I have a strange problem with using Owin cookie authentication.

When I start my IIS server authentication works perfectly fine on IE/Firefox and Chrome.

I st

9条回答
  •  遥遥无期
    2020-11-22 14:22

    The fastest one-line code solution:

    HttpContext.Current.Session["RunSession"] = "1";
    

    Just add this line before CreateIdentity method:

    HttpContext.Current.Session["RunSession"] = "1";
    var userIdentity = userManager.CreateIdentity(user, DefaultAuthenticationTypes.ApplicationCookie);
    _authenticationManager.SignIn(new AuthenticationProperties { IsPersistent = rememberLogin }, userIdentity);
    

提交回复
热议问题