日期:2014-05-20  浏览次数:21316 次

httpWebRequest如何POST,JSON数据?服务器接收的是JSON数据。
POST a.php HTTP/1.1
Accept: application/json, text/javascript, */*; q=0.01
Content-Type: application/json
X-Requested-With: XMLHttpRequest
Accept-Language: zh-cn
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
Content-Length: 132
Connection: Keep-Alive
Pragma: no-cache


{"aaa":"7","xxxx":[{"ddd":"218","ccc":"695","eee":100}],"kkk":"a","jjj":"252","ttt":false,"gggg":"a_1"}

这串是POST的原型。

string postData = "{"aaa":"7","xxxx":[{"ddd":"218","ccc":"695","eee":100}],"kkk":"a","jjj":"252","ttt":false,"gggg":"a_1"}";

完全POST不过去。

------解决方案--------------------
不太明白,postData转换成指定编码对应的字节数组,提交不就OK了?