Set Thread.CurrentPrincipal Asynchronously?

后端 未结 1 513
别那么骄傲
别那么骄傲 2020-12-04 01:29

Using ASP.NET WebAPI, during authentication, Thread.CurrentPrincipal is set so that controllers can later use the ApiController.User property.

相关标签:
1条回答
  • 2020-12-04 02:15

    You have to set HttpContext.Current.User as well. See this answer and this blog post for more info.

    Update: Also ensure you are running on .NET 4.5 and have UserTaskFriendlySynchronizationContext set to true.

    0 讨论(0)
提交回复
热议问题