小编use*_*759的帖子

如何在 Web API 中使用“User.Identity.IsAuthenticated”

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总是falseApiControllertrue在 MVC 控制器中。

c# asp.net-mvc asp.net-web-api

5
推荐指数
2
解决办法
4685
查看次数

标签 统计

asp.net-mvc ×1

asp.net-web-api ×1

c# ×1