我想返回一个RedirectToRouteResult
,将用户重定向到以下格式的URL:
/MyController/MyAction/id?newid=3&newid=5&newid=7
“newid”参数有几个值。
我的调用看起来像这样:return RedirectToAction(string.Empty, routeValues);
以下是我迄今为止尝试过但不起作用的内容:
// ...?newid%5B0%5D=3&newid%5B1%5D=5&newid%5B2%5D=7
var routeValues = new RouteValueDictionary {
{"id", myid},
{"newid[0]", 3},
{"newid[1]", 5},
{"newid[2]", 7},
};
// ...?newid=System.Int32%5B%5D
var routeValues = new { id = myid, newid = new int[] { 3, 5, 7 } };
// ...?newid=System.String%5B%5D
var routeValues = new { id = myid, newid = new string[] { "3", "5", "7" } };
// ...?newid=System.Int32%5B%5D
var routeValues = new RouteValueDictionary {
{"id", myid},
{"newid", new int[] { 3, 5, 7 } }
};
怎么才能让这个工作起来?