I have an action defined like this:
public ActionResult Foo(int[] bar) { ... }
Url, how it will work, as expected:
.../Controller/Foo?bar=1&bar=3&bar=5
I have another action that does some work and then redirects to the Foo action above for some calculated bar values.
Is there an easy way to specify route values ββusing RedirectToAction or ActionLink so that the URL is generated as in the example above?
They do not work:
return RedirectToAction("Foo", new { bar = new[] { 1, 3, 5 } }); return RedirectToAction("Foo", new[] { 1, 3, 5 }); <%= Html.ActionLink("Foo", "Foo", new { bar = new[] { 1, 3, 5 } }) %> <%= Html.ActionLink("Foo", "Foo", new[] { 1, 3, 5 }) %>
However, for one element of the array, they work:
return RedirectToAction("Foo", new { bar = 1 }); <%= Html.ActionLink("Foo", "Foo", new { bar = 1 }) %>
When you configure the panel to an array, it redirects to the following:
.../Controller/Foo?bar=System.Int32[]
Finally, this is with ASP.NET MVC 2 RC.
Thanks.