IPageRouteModelConvention lets an ASP.NET Core Razor Pages application customize route templates while page route models are constructed. Registering a convention can rewrite routes or add routes automatically for every Razor Page. section 14.6
Prefix every page route
A custom convention can combine the prefix "page" with each selector's existing template. A page at Pages/Privacy.cshtml, normally reached as "Privacy", can then also be reached as "page/Privacy". Register the convention through AddRazorPagesOptions and its Conventions collection. section 14.6
Choose the convention mechanism that matches the customization:
- Use AddPageRoute when one page needs an additional route without replacing its default route. section 14.6
- Use IPageRouteModelConvention for application-wide route rewriting or automatic route creation, including localized URL patterns. section 14.6
