I am trying to get away from having to manually specify the layout path in every Razor view that I have / create.
So, in razor mode, you usually specify view / layout properties, such as:
@{
ViewBag.Title = "About Us";
Layout = "~/Views/Shared/_ContentLayout.cshtml";
}
I have a basic controller that inherits all my controllers, in which I would like to specify the layout at this level or, alternatively, in app_start, etc.
For any exceptions, I would just override this in the view itself.
After an extensive search, I did not find any evidence that anyone else could do this.
My current, best workaround is to specify this in the ViewBag so that it is dynamic, but I still need to put the ad in the view:
@{
Layout = ViewBag.Layout;
}
Is it possible? Solutions?