I have a pretty vanilla controller:
public class HomeController : Controller { private readonly ApplicationUserManager _applicationUserManager; public HomeController() { _applicationUserManager = HttpContext.GetOwinContext().GetUserManager<ApplicationUserManager>(); } }
However, when I hit it, the HttpContext is null.
HttpContext
HttpContext refers to the constructor. There is no HttpContext , since they are only created when there is a request.
Moving HttpContext.GetOwinContext().GetUserManager<ApplicationUserManager>(); into action solves the problem.
HttpContext.GetOwinContext().GetUserManager<ApplicationUserManager>();
Source: https://habr.com/ru/post/1233432/More articles:django.core.exceptions.AppRegistryNotReady: applications not yet loaded. django 1.8 - pythonWhat should you do to set up operations on custom objects? - setWhen a function template specializes in another namespace, GCC and clang disagree - c ++Finding the smallest polygon covering a set of points in a grid - algorithmWhy does the Parsec Choice operator seem to depend on the order of the parsers? - haskellEffective JavaScript style change for the entire class of elements - javascriptJUnit scheduler that is not dependent on Android - unit-testingHow to resolve absolute requests using webpack? - webpackGenerate a random double value between -1 and 1 - ctvos Switching PressesBegan - buttonAll Articles