执行以下控制器操作
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 });
}
如果我用/Mycontroller/NextBySURNAME/12/Smith%20Simon调用它
那么它工作得很好(在本例中编辑记录12),但是
/Mycontroller/NextBySURNAME/12/Smith%20
给了我一个404
现在我知道在某些情况下,在我的问题域中,尾随空格是很重要的,所以我不想只是修剪它。那么为什么这会破坏我的路线呢?
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
);
https://stackoverflow.com/questions/3206096
复制相似问题