bagaimana mendapatkan pengguna menampilkan core controller mvc 3.1
string userName = _httpContextAccessor.HttpContext.User.Identity.Name;
Expensive Echidna
string userName = _httpContextAccessor.HttpContext.User.Identity.Name;
public string LoggedInUser => User.Identity.Name;
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
private readonly IHttpContextAccessor _httpContextAccessor;
//constructor then
_httpContextAccessor = httpContextAccessor;