Per this StackOverflow answer, my understanding is that my error views (404.cshtml, etc) should pick up the standard _ViewStart.cshtml and thus be rendered within my _Layout.cshtml like all my other views, but this is not working.
If I add the contents of _ViewStart.cshtml to my error view manually, I do get my error view rendered within my _Layout.cshtml as expected:
Looking at the error views in the sample project, I see they are written as full HTML documents, but this goes against the rest of the Asp.Net MVC convention. Instead, error views should pick up _ViewStart.cshtml (if present).
Here is a suggested fix to CustomErrorHandlingModule.RenderCustomErrorView(). Pass in true instead of false for the runViewStartPages value:
var view = new RazorView(controllerContext, viewPath, null, true, null);
Per this StackOverflow answer, my understanding is that my error views (404.cshtml, etc) should pick up the standard _ViewStart.cshtml and thus be rendered within my _Layout.cshtml like all my other views, but this is not working.
If I add the contents of _ViewStart.cshtml to my error view manually, I do get my error view rendered within my _Layout.cshtml as expected:
Looking at the error views in the sample project, I see they are written as full HTML documents, but this goes against the rest of the Asp.Net MVC convention. Instead, error views should pick up _ViewStart.cshtml (if present).
Here is a suggested fix to CustomErrorHandlingModule.RenderCustomErrorView(). Pass in true instead of false for the runViewStartPages value: