Here's the About.cshtml from the default MVC 3 template:
@{
ViewBag.Title = "About Us";
}
<h2>About</h2>
<p>
Put content here.
</p>
I would expect that a reference to the _ViewStart file would be found in the About.cshtml
, but clearly it's not.
I've looked in global.asax
and web.config
, but I can't find out how the About.cshtml
file is "linked" with the layout from the _ViewStart file.
Everything works as expected, I'd just like to know what's going on under the hood...
In a more general sense this ability of MVC framework to "know" about _Viewstart.cshtml is called "Coding by convention".
Wikipedia
There's no magic to it. Its just been written into the core codebase of the MVC framework and is therefore something that MVC "knows" about. That why you don't find it in the .config files or elsewhere; it's actually in the MVC code. You can however override to alter or null out these conventions.