首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET Framework >

httpWebRequest怎么POST,JSON数据?服务器接收的是JSON数据

2012-03-24 
httpWebRequest如何POST,JSON数据?服务器接收的是JSON数据。POST a.php HTTP/1.1Accept: application/json,

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了?

热点排行