User.Identity.IsAuthenticated总是false在我的 ASP.NET Web API 项目中返回。
在帐户中,ApiController我有以下内容:
ClaimsIdentity identity = new ClaimsIdentity(claims, DefaultAuthenticationTypes.ApplicationCookie);
AuthenticationManager.SignIn(new AuthenticationProperties() {
IsPersistent = isPersistent
}, identity);
Run Code Online (Sandbox Code Playgroud)
登录后,User.Identity.IsAuthenticated总是false在ApiController
但true在 MVC 控制器中。