A URL scheme defines how an application formats and interprets its URLs. In SportsStore, routing replaces query-string pagination such as /?productPage=2 with composable paths such as /Page2. section 7.4.2
ASP.NET Core routing handles incoming requests and generates outgoing URLs, keeping browser links and application routes consistent. Route templates map paths to the Home controller’s Index action. section 8.1.2
Define routes in Program.cs
app.MapControllerRoute("catpage", "{category}/Page{productPage:int}", new { Controller = "Home", action = "Index" }); app.MapControllerRoute("page", "Page{productPage:int}", new { Controller = "Home", action = "Index", productPage = 1 }); app.MapControllerRoute("category", "{category}", new { Controller = "Home", action = "Index", productPage = 1 }); The int constraint distinguishes numeric page values, while route defaults make the root and category URLs represent page 1.
Generated links can receive route values from Razor tag helpers. A page-url-category attribute is collected into a dictionary and passed to IUrlHelper.Action, allowing pagination links to follow the same category-aware scheme. section 8.1.2
