I have a controller named BaseController
, which is inherited by all other Controllers. I have a constructor of BaseController
where I am doing some calculation on the basis of a variable patId which it picks from session and on the basis of this calculation user is allowed to perform some actions.
But there is a Controller MyController
whose action receives this variable first time into this module from another application module so till then it is not set into the session.
public ActionResult MyAction(string patId)
{
// First time patId is been set into session
}
So my BaseController
calculation is getting wrong for this action. Is there a way I can get this variable value into constructor of BaseController
. So that I can check if session value is null then check for this parameter and set the session.
Please suggest if I can do this or I can solve out my issue from any another way.