If I have a simple controller routed as follows:
context.MapRoute(
"Default",
"{controller}/{action}",
new { controller = "Base", action = "Foo"}
);
And the controller Foo action is as follows:
[HttpPost]
public ActionResult Foo(object bar) { ... }
How will bar
be bound? I have debugged and see it is a string
, but I'm not sure if it will always be marshalled to a string.
Basically I want to have the method accept a bool
, List<int>
, and int
. I can send up a type parameter and do the model binding myself from the post. (The post is a form post).
Here are my current posts &bar=False
or &bar=23
or &bar[0]=24&bar[1]=22
.
I know I can look at the post inside the Foo action method, but I want some input on the best way to handle this in MVC3