At Razor, the model of Master Page
is not used. What exists are files from Layout, used by View
to build.
Unlike Master Pages, where content sections were specified using a set of tags of their own, Razor uses pure HTML, processing notations and returning more HTML. The approach is simpler and less error-prone on the server part.
Normally the Main view layout file (i.e., the one that opens in a computer browser) is inside Views\Shared
by the name of _Layout.cshtml
, but nothing prevents you from modifying this name. In this directory should be placed other Layout files common to the system. Layouts that are specific to certain Views belonging to a Controller can be in the specific directory of these Views.
The Wizard that you executed only generates a View with the following statement, which is fully optional:
@{
Layout = "~/Views/Caminho/Da/Minha/View/_Layout.cshtml";
}
This statement is also found in the special View _ViewStart.cshtml
, which starts a Default Layout if no Layout is specified:
@{
Layout = "~/Views/Shared/_Layout.cshtml";
}
You are using Razor?
– Leonel Sanches da Silva
Yes, I am using Razor. Why? It does not let me view the master page?
– Cleiton Ribeiro