ASP.NET Core 2.2 get userId in DbContext

asp.net-core asp.net-identity c# entity-framework entity-framework-core

Accepted Answer

ZZZ_tmp
1
8/22/2019 9:09:14 AM

Popular Answer

private async Task<ApplicationUser> GetUserDetailsAnsyc()
{
  return await userManager.GetUserAnsync(HttpContext.User);
}

var user = await GetUserDetailsAnsyc();
Console.WriteLine(user.Id.ToString());


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow