相关疑难解决方法(0)

如何在Web Api中使用带有响应的Httpclient获取对象

我的网络api喜欢

    public async Task<IHttpActionResult> RegisterUser(User user)
    {
        //User Implementation here

        return Ok(user);
    }
Run Code Online (Sandbox Code Playgroud)

我正在使用HTTPClient来请求web api,如下所述.

var client = new HttpClient();
string json = JsonConvert.SerializeObject(model);
var result = await client.PostAsync( "api/users", new StringContent(json, Encoding.UTF8, "application/json"));
Run Code Online (Sandbox Code Playgroud)

在我的结果请求中可以找到在客户端应用程序上实现的用户对象?

c# asp.net asp.net-mvc asp.net-web-api asp.net-web-api2

15
推荐指数
2
解决办法
2万
查看次数