我在Web应用程序中登录,但是isAuthenticated变量始终返回false
*
https://imgur.com/a/mRWYlBj#YtR6jJf //此代码返回true https://imgur.com/a/mRWYlBj#Nj332IC //此代码返回false
*
ClaimsPrincipal icp = Thread.CurrentPrincipal as ClaimsPrincipal;
ClaimsIdentity claimsIdentity = (ClaimsIdentity)icp.Identity;
bool isAuthenticated = icp.Identity.IsAuthenticated;
if (!HttpContext.Current.User.Identity.IsAuthenticated)
{
base.HandleUnauthorizedRequest(actionContext);
}
else
{
actionContext.Response = new System.Net.Http.HttpResponseMessage(System.Net.HttpStatusCode.Forbidden);
}