Routing is a pattern matching system that monitor the incoming request and figure out what to do with that request. At run time, Routing engine use the Route table for matching the incoming request’s URL pattern against the URL patterns defined in the Route table. You can register one or more URL patterns to the Route table at Application_Start event.

When the routing engine finds a match in the route table for the incoming request’s URL, it forwards the request to the appropriate controller and action. If there is no match in the route table for the incoming request’s URL, it returns a 404 HTTP status code.

 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
     });
   }
 }


public class Global : System.Web.HttpApplication
   {

       protected void Application_Start(object sender, EventArgs e)
       {
                       
           RouteConfig.RegisterRoutes(RouteTable.Routes);

       }
   }

Happy Coding 🙂