You cannot directly refer to HttpContext.User , except possibly inside the controller. User is a property of the HttpContext class. You can do something like this:
HttpContext context = HttpContext.Current; IPrincipal user = context.User;
that is, you can refer to a property through an instance of the HttpContext class.
The base class of the Controller has a property called HttpContext . Inside the controller, if you reference HttpContext.User , you refer to base.HttpContext.User , which usually (always?) Will be the same as HttpContext.Current.User , simply because base.HttpContext will be at all (maybe always ?) Be the same as HttpContext.Current .
source share