I have created a angular 2 application using .NET Core and MVC. I want to know the login id of user. How to get logged in id of a user in .net core?
This is my first
private readonly ApplicationDbContext _dbContext;
private readonly IHttpContextAccessor _httpContext;
private readonly string _userId;
public MyController(UserManager _userManager, IHttpContextAccessor _httpContext)
{
this._userManager = _userManager;
this._httpContext = _httpContext;
_userId = this._userManager.GetUserId(this._httpContext.HttpContext.User);
}