您无法发出POST请求。

编程入门 行业动态 更新时间:2024-10-25 18:28:00
本文介绍了您无法发出POST请求。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

这与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请求。

本文发布于:2023-10-10 01:30:48,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1477323.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:POST

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!