The Default Route is the standard routing pattern that ASP.NET MVC uses to map URLs to Controllers and Action methods.
It is automatically created when you create a new MVC project.
{controller}/{action}/{id}
RouteConfig.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
namespace Your_Project_Name
{
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new
{
controller = "Home",action = "Index",id = UrlParameter.Optional
}
);
}
}
}URL:
https://localhost:1234/Student/Details/5
Explanation:
URL:
https://localhost:1234/
Since no controller and action are given, MVC uses default values:
So it automatically calls:
HomeController → Index()
Imagine a school:
If you don’t mention department, the school sends you to the Main Office (Home/Index).
✔ Default route connects URL to Controller & Action
✔ Pattern: {controller}/{action}/{id}
✔ id is optional
✔ Home/Index is default fallback