Reputation: 870
I have weird behavior using asp.net core 3.1 which is as follows When I called
This is called in AccountController.Login action method
The result return with Succeeded, and user will redirected to Dashboard/Index action method, however when I check HttpContext.User.Identity
It always return with empty identity object that have default values for all its inner properties.
I tried to set the value manually but it still the empty object even when I set it to null
Here is full ConfigureService method that I use
Upvotes: 2
Views: 3716
Reputation: 36655
You need to be sure that call the middleware in the order like below: UseRouting
, UseAuthentication
, UseAuthorization
, and UseEndpoints
.
Reference:
Upvotes: 6