web-api POST body object always null

前端 未结 26 3064
余生分开走
余生分开走 2020-11-27 15:03

I\'m still learning web API, so pardon me if my question sounds stupid.

I have this in my StudentController:

public HttpResponseMessage          


        
26条回答
  •  天命终不由人
    2020-11-27 15:30

    After Three days of searching and none of above solutions worked for me , I found another approach to this problem in this Link: HttpRequestMessage

    I used one of the solutions in this site

    [HttpPost]
    public async System.Threading.Tasks.Task Post(HttpRequestMessage request)
    {
        string body = await request.Content.ReadAsStringAsync();
        return body;
    }
    

提交回复
热议问题