2018-2-13-win10-uwp-HttpClient-post错误

title author date CreateTime categories
win10 uwp HttpClient post错误
lindexi
2018-2-13 17:23:3 +0800
2018-2-13 17:23:3 +0800
Win10 UWP

进行HttpClient post参数错误 从“Windows.Web.Http.HttpStringContent”转换为“System.Net.Http.HttpContent”

原因

用了System.Net.Http.HttpClient其实HttpStringContent是可以在错误看到,不是System.Net.Http

方法

使用

           Windows.Web.Http.HttpClient webHttpClient=
                new Windows.Web.Http.HttpClient();

           Windows.Web.Http.HttpStringContent httpString=
                new HttpStringContent("a");
            await webHttpClient.PostAsync(new Uri(url), httpString);

CodeProject

posted @ 2019-11-21 16:09  lindexi  阅读(123)  评论(0)    收藏  举报