In an attribute inheriting from ActionFilterAttribute
is there a way I can get to the current master page name OnActionExecuting
?
Thanks, Nath
In an attribute inheriting from ActionFilterAttribute
is there a way I can get to the current master page name OnActionExecuting
?
Thanks, Nath
This is not possible, because at this point it is not clear which view you will return. That also means you can not know which Masterpage you will render.
What you want to achieve by this?
I think it is impossible (there is no ActionResult at that time) but you could try in OnActionExecuted(). This should work:
public override void OnActionExecuted(ActionExecutedContext filterContext)
{
var masterName = (filterContext.Result as ViewResult).MasterName;
}