可能重複: difference between http.context.user and thread.currentprincipal and when to use them? 是什麼在ASP.NET應用程序中這兩者之間的區別? 我知道當用戶通過FormsAuthentication認證的HttpContext.User.Identity設置。但是什麼時候設置了Thread.Current
我確實創建了自定義AuthorizeAttribute,該應用程序應處理Jwt不記名令牌,然後創建ClaimsIdentity。但是當我再次發送請求時,無論如何我都看不到授權用戶,並且必須再次創建ClaimsIdentity並再次將用戶添加到CurrentPricipal。我做錯了什麼? public class JwtAuthorizeAttribute : AuthorizeAttribute