MVC model binding: using a name other than QueryString for a method parameter
Given the url:
http://www.stackoverflow.com/question ask = 123 & answers = 5
and the corresponding ActionMethod and Model:
public ActionResult Question(RequestObject request)
{
return View("Question", request);
}
public class RequestObject
{
public string AskId
{
get;
set;
}
public string NumberOfAnswers
{
get;
set;
}
}
Note that QueryString and RequestObject parameters are different. Can I achieve this with the default binding behavior? Do I need to create a custom binder?
Thank!
+2
user129393
source
to share
3 answers