Accessing the query string in ASP.Net Web Api?

后端 未结 3 1895
礼貌的吻别
礼貌的吻别 2020-12-14 06:09

I\'m using the default template generated by Asp.net Web Api. I\'m working with the Get() Part:

        // GET api/values
    public IEnumerable

        
3条回答
  •  清歌不尽
    2020-12-14 06:56

    The query string key name should match the parameter name of the action:

    /api/values?queryString=f

    public IEnumerable Get(string queryString)
        {
            return new string[] { "value3", "value4" };
        }
    

提交回复
热议问题