i was reading about the Convintional routing order in the docs but i read this sentence , can any one give me an explanation to the below sentence with code :
Conventional routing only matches a combination of action and controller that are defined by the app. This is intended to simplify cases where conventional routes overlap. Adding routes using MapControllerRoute, MapDefaultControllerRoute, and MapAreaControllerRoute automatically assign an order value to their endpoints based on the order they are invoked. Matches from a route that appears earlier have a higher priority. Conventional routing is order-dependent. In general, routes with areas should be placed earlier as they're more specific than routes without an area. Dedicated conventional routes with catch-all route parameters like {*article} can make a route too greedy, meaning that it matches URLs that you intended to be matched by other routes. Put the greedy routes later in the route table to prevent greedy matches.

Naimish MakwanaPosted Sep 5, 2024, 9:00 AM
Conventional routing in ASP.NET Core is a way to define routes that map URL patterns to controllers and actions. The key points from the sentence are:
MapControllerRoute,MapDefaultControllerRoute, andMapAreaControllerRoute, they are assigned an order based on the sequence they are added.{*article}) can match more URLs than intended, so they should be placed later to avoid unintended matches.Code Example
Here’s an example to illustrate these points:
Breakdown
Admin Area Route:
This route is specific to the “Admin” area and is placed first because it is more specific.
Default Route:
This is the default route pattern
{controller=Home}/{action=Index}/{id?}. It is less specific than the area route but more specific than the greedy route.Greedy Route:
This route uses a catch-all parameter
{*article}and is placed last to avoid it matching URLs that should be handled by the more specific routes defined earlier.By following this order, you ensure that the most specific routes are matched first, and the greedy routes are matched only if no other routes apply. This helps prevent unintended matches and ensures that your routing logic works as expected.
Thanks
Jignesh KumarPosted Sep 4, 2024, 3:37 AM
Hello Mina,
In .Net Core application,
Startup.cs: Similar to endpoint routing, conventional routing can also be defined in theConfiguremethod. However, this approach is generally considered older compared to endpoint routing.How to register in Configure method of start up class,