3
我最近将项目从MVC3升级到MVC4,此后,我的某些动作参数被错误传递。如果JSON调用传递一个空数组从ASP.NET MVC 3升级到MVC 4,参数被替换为路由
public JsonResult FooAction(int id, int id2, string name, string name2, List<Object1> templates, Dictionary<string, string> dictionary1, Dictionary<string, List<string>> dictionary2);
:
"dictionary2":[]
然后dictionary2
设置为路由:
{key = "controller", value = "MyController"}
{key = "action", value = "MyAction"}
{key = "id", value = "123123"}
很显然,我
该动作有这个签名'它喜欢它只是一个空的字典 - 有什么办法可以防止这种行为?
[编辑]我要指出,我使用的是默认的路由行为:
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = "" }
);