how to get current user in asp.net core code example
Example 1: how get the user show mvc controller core 3.1
string userName = _httpContextAccessor.HttpContext.User.Identity.Name;
Example 2: dotnet core 3.1 get the user that just logged in
private Task<ApplicationUser> GetCurrentUserAsync() => _userManager.GetUserAsync(HttpContext.User);
Example 3: how get the user show mvc controller core 3.1
private readonly IHttpContextAccessor _httpContextAccessor;
_httpContextAccessor = httpContextAccessor;