That's normal, all HttpContext
related objects such as the Session
are not yet initialized in the constructor of an ASP.NET MVC controller. This happens at a later stage, in the Initialize
method that you could use:
public BaseController: Controller
{
protected override void Initialize(RequestContext requestContext)
{
base.Initialize(requestContext);
ViewBag.UserMenu = this.UserIntranet.Login;
}
}