accessing HttpContext.Request in a controller's constructor
问题 I'm following this ASP.NET MVC tutorial from Microsoft: My code is slightly different, where I'm trying to access HttpContext.Request.IsAuthenticated in the controller's constructor. namespace SCE.Controllers.Application { public abstract class ApplicationController : Controller { public ApplicationController() { bool usuario = HttpContext.Request.IsAuthenticated; } } } The problem is that HttpContext is always null. Is there a solution to this? 回答1: The Controller is instantiated