从wp8 app中的httpclient postasync获得响应

时间:2015-02-17 17:56:44

标签: windows-phone-8 httpclient

我有以下代码将照片上传到网络服务,我需要从服务获得响应,我在这里使用httpclient课程是我的代码

var fileUploadUrl = Globals.baseUrl + "/laravelProjects/VisWall/public/test";
                    var client = new HttpClient();
                    photoStream.Position = 0;
                    MultipartFormDataContent content = new MultipartFormDataContent();
                   content.Add(new StreamContent(photoStream), "image", "koko");
                    await client.PostAsync(fileUploadUrl, content).ContinueWith((postTask) =>
                    {
                        postTask.Result.EnsureSuccessStatusCode();
                    });
                }

1 个答案:

答案 0 :(得分:0)

我刚刚找到了你应该从结果内容中读取字符串异步的答案

string stringResponse =await postTask.Content.ReadAsStringAsync();