这与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 );
解决方案
我并没有真正关注你要解决的问题。你能否告诉我们更多细节?任何错误信息都可以你分享了吗?
如果您对c#中的帖子请求有疑问,请参阅:
/ / p>
带有帖子的HTTP请求
.NET:使用数据发送POST的最简单方法阅读回复
你可以谷歌对于更多。
希望这对您有所帮助。
最好的问候,
Bob
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 = "...."; HttpWebResponse webResponse = Upload.MultipartFormDataPost(postURL, postParameters); StreamReader responseReader = new StreamReader(webResponse.GetResponseStream()); string fullResponse = responseReader.ReadToEnd(); webResponse.Close(); Response.Write(fullResponse);解决方案
Hi,
I'm not really following what problem you're trying to solve. Could you showus more details? Any error message can you share?
If you have issue about Post request in c#, Please refer :
How to: Send Data Using the WebRequest Class
HTTP request with post
.NET: Simplest way to send POST with data and read response
You can google for themore.
Hope this can be helpful to you.
Best Regards,
Bob
更多推荐
您无法发出POST请求。
发布评论