Answers for "asp.net core identity custom user"

C#
4

asp.net core identity get user id

public async Task<IActionResult> YourMethodName()
    {
        var userId =  User.FindFirstValue(ClaimTypes.NameIdentifier) // will give the user's userId
        var userName =  User.FindFirstValue(ClaimTypes.Name) // will give the user's userName

        ApplicationUser applicationUser = await _userManager.GetUserAsync(User);
        string userEmail = applicationUser?.Email; // will give the user's Email
    }
Posted by: Guest on October-07-2020

C# Answers by Framework

Browse Popular Code Answers by Language