Successfully added
ASP.NET Core
by Matthew
The @page Directive
In a Razor view page (.cshtml), the @page
directive indicates that the file is a Razor Page.
In order for the page to be treated as a Razor Page, and have ASP.NET parse the view syntax with the Razor engine, the directive @page
should be added at the top of the file.
There can be empty space before the @page
directive, but there cannot be any other characters, even an empty code block.
@page | |
@model IndexModel | |
<h1>Welcome to my Razor Page</h1> | |
<p>Title: @Model.Title</p> |
Referenced in:
Comments