[UWP]如果我将Nugets .netCore.UniversalWindowsPlateform v5.1升级到v5.2.2我的HttpWebRequest" POST"停止工作 [英] [UWP]If I upgrade Nugets .netCore.UniversalWindowsPlateform v5.1 to v5.2.2 my HttpWebRequest "POST" stop working

查看:71
本文介绍了[UWP]如果我将Nugets .netCore.UniversalWindowsPlateform v5.1升级到v5.2.2我的HttpWebRequest" POST"停止工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我注意到了UniversalWindowsPlateform的v5.2和5.1之间的某些内容 


我在v5.1中有一个应用程序,并且执行了"POST"操作。操作HttpWebRequest,主体中的参数以UTF8编码。 (模拟在网站上登录)


如果升级到v5 .2,我的POST停止工作!


我恢复到v5.1它再次运作!


你有什么想法吗?


mycode的摘录


HttpWebRequest request =(HttpWebRequest)WebRequest。 Create(url rest.AbsoluteUri);


< p style ="color:#222222; font-family:arial,sans-serif; font-size:12.8px"> request.CookieContainer = new CookieContainer();


ASCIIEncoding encoding = new ASCIIEncoding();



// Encoding.UTF8.GetBytes( postString);


byte [] postData = Encoding.UTF8.GetBytes (所有 para m 主体中);


//所有 param in_body


request.ContentType =" POST";


Stream newStream = await request.GetRequestStreamAsync();


newStream.Write(postData,0,postData.Length);


newStream.Dispose();


response =(HttpWebResponse)await request.GetResponseAsync();



cdt

解决方案

v5会发生什么。 2?  您收到错误了吗?  我也更喜欢HttpClient到HttpWebRequest


Hi

I notice something between the v5.2 and 5.1 of the UniversalWindowsPlateform 

I have an application in v5.1 and a do a "POST" opperation whith a HttpWebRequest , with parameter in the body encode in UTF8. (to simulate a login on a webSite)

If a upgrade to v5.2, my POST stop working !

I restore to v5.1 and it work again !

Have you got an idea ?

extract of mycode

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(urlrest.AbsoluteUri);

request.CookieContainer = new CookieContainer();

ASCIIEncoding encoding = new ASCIIEncoding();

//Encoding.UTF8.GetBytes(postString);

byte[] postData = Encoding.UTF8.GetBytes(allparaminbody);

//allparamin_body

request.ContentType = "POST";

Stream newStream = await request.GetRequestStreamAsync();

newStream.Write(postData, 0, postData.Length);

newStream.Dispose();

response = (HttpWebResponse)await request.GetResponseAsync();

cdt

解决方案

what happens with v5.2?  Do you get an error?  I also prefer the HttpClient to the HttpWebRequest


这篇关于[UWP]如果我将Nugets .netCore.UniversalWindowsPlateform v5.1升级到v5.2.2我的HttpWebRequest&quot; POST&quot;停止工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆