Read how to define "catchall" in the route here.
To catch the route url segments value into controller action method, we use the name of the url parameter as parameter of the action method in general.
CONTROLLER CODE
public class RoutingStuffsController : Controller
{
public ActionResult CatchAll(string id = null, string catchall = null)
{
ViewBag.Action = "CatchAll";
ViewBag.Controller = "RoutingStuffs";
ViewBag.Id = id;
ViewBag.CatchAll = catchall;
return View();
}
}
If the following url is requested from the browser
http://localhost:63087/Route/RoutingStuffs/CatchAll/50/Delete/And/Other/Parameter
it directly comes to the above action method of the RoutingStuffs controller and note that as per routing instruction in the previous point
VIEW CODE
@{ ViewBag.Title = "CatchAll"; } <h2>Catch All</h2> <p>Controller : @ViewBag.Controller</p> <p>Action : @ViewBag.Action</p> <p>Id : @ViewBag.Id</p> <p>CatchAll : @ViewBag.CatchAll</p>
In the above view we are writing the url segments values passed to the action method.