我已经注册了各种路线,并且刚刚将以下内容添加到我的收藏夹顶部:
routes.MapRoute("EmployeesUnassign", "Terminals_Employees/UnAssignEmployee/{employeeId}/{datagroupId}", new { controller = "Terminals_Employees", action = "UnAssignEmployee" });
routes.MapRoute("Employees", "Terminals_Employees/{id}", new { controller = "Terminals_Employees", action = "Index" });
如果我尝试转到/Terminals_Employees/UnAssignEmployee/1/2
我收到以下错误:
The parameters dictionary contains a null entry for parameter 'id' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult Index(Int32)' in 'Terminals_Employees.Controllers.Terminals_Employees'
如果我删除这些路线,那么一切都很好。
答案 0 :(得分:0)
我已经意识到这个问题,转到网址工作正常,但我是通过ajax发布它们,这当然意味着这些值不是网址的一部分,而是包含在标题中。