0
如何设计我的URL匹配这样我的函数:ASP.NET MVC多个查询字符串参数
public ActionResult GetStuff(string name, string address, double latitude, double longitude)
{ }
如何设计我的URL匹配这样我的函数:ASP.NET MVC多个查询字符串参数
public ActionResult GetStuff(string name, string address, double latitude, double longitude)
{ }
添加路由与中有所有这些参数的签名。
routes.MapRoute("myRoute",
"{controller}/{action}/{name}/{address}/{latitude}/{longitude}",
new { controller = "Home",
action = "GetStuff",
latitude=0.0,
longitude =0.0, address="", name = "" }
);
如果你只是打算POST数据到该操作方法,然后在你的方法签名的参数名称可以只匹配命名输入字段的形式代替。
它也可以使用默认路由,将所有额外值作为查询值:/ controller/action?name = a&address = b&latitude = c&longitude = d – 2010-01-14 15:34:21