The files that make up the base views

The entry point for our view is the special _ViewStart.cshtml file. This file defines the common layout that the application will display. Rather than adding the contents to this file directly, we place the contents in a file called _Layout.cshtml and refer to this (minus the file extension) when setting the Layout file, like this:

@{    Layout = "_Layout";}
Files that end with .cshtml have a special meaning to ASP.NET. This tells the application that these files are a combination of C# and HTML, which the underlying engine will have to compile before serving the result to the browser. We should be very familiar with this concept by now, having seen similar behavior with both React and Vue.

Now that we have ...

Get Advanced TypeScript Programming Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.