Take the following controller action
public ActionResult NextBySURNAME(int id, string data)
{
//code to process the data and edit the id accoringly not written yet
return RedirectToAction("Edit", new { id = id });
}
if I call it with /Mycontroller/NextBySURNAME/12/Smith%20Simon
then it works fine (in this case editing record 12) but
/Mycontroller/NextBySURNAME/12/Smith%20
gives me a 404
Now I know that in some cases in my problem domain trailing whitespace is significant, so I don't just want to trim it. So why is this breaking my route ?
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}/{data}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional, data=UrlParameter.Optional } // Parameter defaults
);