In asp.net MVC 3 is there a way to override the Layout declaration set in a view from a controller or action filter?
@{
Layout = "~/Views/Shared/_Layout.cshtml";
}
I have tried overriding the MasterName property in the OnResultExecuted or the OnResultExecuting like the following code snippet, to no avail.
public override void OnResultExecuting(ResultExecutingContext filterContext)
{
var view = filterContext.Result as ViewResult;
view.MasterName = null;
}