How does a view know which layout to use? Where is the default?

asp.net-mvc, layout, razor

Solution

Because your `_ViewStart.cshtml` contains a reference to the default layout that will be used when a specific one is not stated on the view.

When you want to change the layout for a single view, you would include a `Layout = "...";` to that view.

Problem

In default mvc app. There are Layout and content pages, You know (_Layout, Home, Contact, etc.) And content pages do not contain layout refrence as this: ``` Layout = "~/Views/Shared/_Layout.cshtml"; ``` In content pages this code is missing. But they works. How does it do this without layout refrence?

Original source