本文介绍了您无法发出POST请求。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 这与PHP中的查询相同: $ result = $ request - > setPOSTdata ( array ( 'xml' => $ xml , '符号' => md5 ( $ xml 。 $ secret_key ), )) - > POST ( $ API_URL ); 不知道如何在C#中构建相同的东西,查找文档中的信息并不能给出解决方案的答案基于我在Windows CE 5.0中编写Net Framework 2.0-3.5的事实。现在我的代码如下: var xml = @"< ;?xml version ='1.0'coding ='utf = 8'?>     < request module ='subdivision'format ='json'>   ;   < filter id =''db =''state =''>     < auth id ='site'>     &l t; / requset>" ;; 字典 < 字符串 , 对象 > postParameters = 新 字典 < 字符串 , 对象 >(); postParameters 。 添加 ( " xml" , xml ); postParameters 。 添加 ( " sign " , ??? ); 字符串 postURL = " https://...." ; HttpWebResponse webResponse = 上传 。 MultipartFormDataPost ( postURL , postParameters ); StreamReader responseReader = 新 StreamReader ( webResponse 。 GetResponseStream ()); 字符串 fullResponse = responseReader 。 ReadToEnd (); webResponse 。 关闭 (); 响应 。 写 ( fullResponse ); 解决方案 Here is the same as the query in PHP:$result = $request->setPOSTdata(array( 'xml' => $xml, 'sign' => md5($xml . $secret_key),))->POST($API_URL);Don't know how to build the same thing in C #, finding information in the documentation do not give answers to the solution to such a request. Based on the fact that I write Windows CE 5.0 where Net Framework 2.0-3.5Now I have code like: var xml = @"<?xml version='1.0' encoding='utf=8'?>        <request module='subdivision' format='json'>        <filter id='' db='' state=''>        <auth id='site'>        </requset>"; Dictionary<string, object> postParameters = new Dictionary<string, object>(); postParameters.Add("xml", xml); postParameters.Add("sign", ??? ); string postURL = "https://...."; HttpWebResponse webResponse = Upload.MultipartFormDataPost(postURL, postParameters); StreamReader responseReader = new StreamReader(webResponse.GetResponseStream()); string fullResponse = responseReader.ReadToEnd(); webResponse.Close(); Response.Write(fullResponse); 解决方案 这篇关于您无法发出POST请求。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-11 12:26