A web browser is calling my action with the following URL;
Request URL:http://localhost:4000/MyController/UrlCheck?Menu.Url=sometext
My action is as follows;
public JsonResult UrlCheck(string Url)
{
return Json("Url is " + Url , JsonRequestBehavior.AllowGet);
}
But the Url parameter never gets bound, I’ve tried the following to no avail;
public JsonResult UrlCheck([Bind(Prefix="Menu")] string Url)
The URL is generated by MVC itself as part of an Ajax post and is tied to a property of a complex object, hence the ‘Menu.Url’ bit. It won’t be easy to change the name of the URL parameter.
Have also tried Menu_Url as a parmeter name. The action is executed so the routing should be working fine.
I haven’t come across binding get parameters like that, but I would try binding to a simple viewmodel that is named
Menuand has a property calledUrl.E.g.
Your Viewmodel
Your Action