ASP.NET Core MVC Interview Question #76
What is advanced routing in ASP.NET Core MVC?
Advanced Routing, Filters, Areas & Application Structure Mid-Level Intermediate
Quick Interview Answer
Advanced routing goes beyond the basic {controller}/{action}/{id?} pattern and uses route constraints, named routes, route order, attribute templates, areas, parameter transformers, and custom routing conventions to create precise URL structures.
Detailed Explanation
Advanced routing goes beyond the basic {controller}/{action}/{id?} pattern and uses route constraints, named routes, route order, attribute templates, areas, parameter transformers, and custom routing conventions to create precise URL structures.
A good routing design should be predictable, unambiguous, and stable. Routes should describe resources and application structure without exposing implementation details unnecessarily.
Code Example
app.MapControllerRoute(
name: "product-details",
pattern: "products/{id:int}",
defaults: new
{
controller = "Products",
action = "Details"
});