Overwrite the method Initialize the base class of the controller. The request context is passed to this method. The session context is part of the request context.
protected override void Initialize(System.Web.Routing.RequestContext requestContext) { base.Initialize(requestContext); var tmp = requestContext.HttpContext.Session["Whatever"]; }
This method is called after the controller is created and before the action method is called.
source share