Custom Parameter Names With Special Characters in ASP.NET Web API MVC 4

后端 未结 2 2108
礼貌的吻别
礼貌的吻别 2020-12-09 14:24

I have a requirement to create a Get method which takes the following parameter names in the URL:

ms-scale ms-contrast ms-lang

As you can see, all the names

2条回答
  •  无人及你
    2020-12-09 14:45

    Use FromUriAttribute

    public HttpResponseMessage Get([FromUri(Name = "ms-scale")]int scale, [FromUri(Name = "ms-contrast")]string contrast, [FromUri(Name = "ms-lang")]string lang)
    

提交回复
热议问题