ASP.NET Core MVC Interview Question #22
What is routing in ASP.NET Core MVC?
MVC Fundamentals, Controllers, Views & Routing Junior Beginner
Quick Interview Answer
Routing matches incoming request URLs to application endpoints and also generates URLs for links and redirects. In MVC, a route normally identifies values such as controller, action, and route parameters.
Detailed Explanation
Routing matches incoming request URLs to application endpoints and also generates URLs for links and redirects. In MVC, a route normally identifies values such as controller, action, and route parameters.
ASP.NET Core supports conventional routing and attribute routing. Route design should produce stable, understandable URLs and avoid ambiguous endpoint patterns.
Code Example
app.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");