The Pages folder is the conventional home for Razor Pages in an ASP.NET Core project. Put a page such as Index.cshtml there; its file name and location relative to Pages determine its URL by default. Pages/Index.cshtml handles /index unless its route is overridden. section 23.2.2
A Razor Page starts with @page so it is treated as a page rather than a controller view. Its @model directive selects a page model; an example defines that model alongside the markup with @functions. The folder gives the file its conventional location, while these directives determine how it behaves. section 23.2.2
Place supporting Razor files in Pages when setting up shared page behavior:
- _ViewImports.cshtml supplies namespaces and enables tag helpers for page markup. section 32.6
- _ViewStart.cshtml selects a default layout, such as _Layout.cshtml, which can also live in Pages. section 32.6
A page at a deliberate URL
Create Pages/Index.cshtml with @page "/pages" to serve /pages rather than relying on the file-based default. A product-list page at that URL can render database results and link to other Razor Pages. In the application setup, AddRazorPages registers the services and MapRazorPages registers page endpoints. section 31.3 section 8.2.1
