POST a string to Web API controller in ASP.NET 4.5 and VS 2012 RC

后端 未结 2 1132
一生所求
一生所求 2021-01-02 03:39

I am new to WebAPI and trying to learn it. I have an WebAPI controller to which I am trying to POST a string using WebClient from my Unit Test.

I am posting a string

2条回答
  •  清歌不尽
    2021-01-02 03:58

    If all you need to receive is one value, use = before the value:

    var result = client.UploadString(_webapiUrl, "POST", "=hello"); // NOTE '='
    

提交回复
热议问题