I have a URL: http://localhost:XXXX/Details/569
I want to shorten it to: http://localhost:XXXX/569
Currently I have:
routes.MapRoute(
    "Default",
    "{controller}/{action}/{id}",
    new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
So what changes do I do in my routes so that when an integer value is entered, it goes to my Details function in the HomeController:
public ActionResult Details(int recordID)
{
    /** Code Here **/
    return View();
}
EDIT: Catching Errors
Also how can I catch for any error that happens in the application? Rather than display an error dump, I would like to show a "nice" message that says, "Oops! Something Broke!".
Add this route before the default one. It will make sure the URLs containing only numbers calls HomeController's Details action.
routes.MapRoute(
    "RecordDetails",
    "xxxx/{RecordID}",
    new { controller = "Home", action = "Details", RecordID=0 },
    new { RecordID = @"\d+" });
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论