开发者

ASP.NET MVC multiple query string parameter

How do I design my URL to match my function like this:

public开发者_JAVA百科 ActionResult GetStuff(string name, string address, double latitude, double longitude)
{ }


Add a route with a signature that has all those parameters in it.

routes.MapRoute("myRoute",
                "{controller}/{action}/{name}/{address}/{latitude}/{longitude}",
                new { controller = "Home", 
                      action = "GetStuff", 
                      latitude=0.0, 
                      longitude =0.0, address="", name = "" }
           );

If you just intend to POST data to that action method, then the parameter names in your method signature can just match named input fields on your form instead.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜