Web.API MapHttpRoute parameters

前端 未结 3 1305
小蘑菇
小蘑菇 2021-02-04 02:48

I\'m having problems with my Web.API routing. I have the following two routes:

config.Routes.MapHttpRoute(
    name: \"Me         


        
3条回答
  •  天涯浪人
    2021-02-04 03:08

    You can choose to pass the parameters in the query string like /MethodTwo?directory=a&report=b, but if you'd rather they show up in the path, this looks like a good candidate for attribute-based routing. Filip has a great post about it here:

    http://www.strathweb.com/2012/05/attribute-based-routing-in-asp-net-web-api/

提交回复
热议问题