How to get logged in user for .NET Core 1.1?

93 Views Asked by At

Using .NET Core 1.1 I have to get the identity of the logged in user. Using HttpContext doesn't seems to give anything. Am I missing something?

In Startup.cs I have this:

services.AddTransient<IHttpContextAccessor, HttpContextAccessor>();

and in the controller I use DI for HttpContext. However the context is null when running in debug mode in Visual Studio. I suppose it would be th same when deployed to IIS (Kerstrel).

What to do?

0

There are 0 best solutions below