在asp.net网页API两个参数的方法 [英] Method with two parameters in asp.net web api
本文介绍了在asp.net网页API两个参数的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我怎样才能让一个方法,使用ASP.NET网页API两个参数?
How can I make a method with two parameters using ASP.NET Web Api?
所以,我可以把它像本地主机/控制器/参数1 /参数2
So that I can call it like localhost/controller/param1/param2
推荐答案
只需更改或添加在Global.asax中的路由
Just change or add route in global.asax
routes.MapHttpRoute(name: "DefaultApi1", routeTemplate: "api/{controller}/{id}/{name}", Defaults: new{} );
这篇关于在asp.net网页API两个参数的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文