1
我有以下路线在Global.asax中定义:指定ASP.NET MVC为图路线特例处理机3
routes.MapRoute(
"IncidentActionWithId", // Route name
"Incidents/{companyId}/{action}/{id}", // URL with parameters
new { controller = "Incidents" } // Parameter defaults
);
我的请求的特殊情况,像这样的:
/Incidents/SuperCompany/SearchPeople/Ko
在这种情况下,动作的确应该映射到SearchPeople
action,comapnyId
这个动作的参数,但只有当动作是SearchPeople时,Ko
不应映射到动作的id参数,而是映射到searchTerm
。
我的行动宣言是:
[HttpGet]
public ActionResult SearchPeople(string companyId, string searchTerm)
我如何能实现Ko
在我的操作方法映射到searchTerm
参数?