您无法发出POST请求。 [英] You can't make a POST request.

查看:88
本文介绍了您无法发出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请求


< a href ="http://stackoverflow.com/questions/4088625/net-simplest-way-to-send-post-with-data-and-read-response"> .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.5
Now 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);


解决方案

Hi,

I'm not really following what problem you're trying to solve. Could you show us 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 the more.

Hope this can be helpful to you.

Best Regards,

Bob


这篇关于您无法发出POST请求。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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