求一个完整的POST源码
我已经知道了POST的内容。
POST http://vdisk.weibo.com/file/moveFiles HTTP/1.1
Host: vdisk.weibo.com
Connection: keep-alive
Content-Length: 316
Origin: http://vdisk.weibo.com
X-Requested-With: XMLHttpRequest
User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.77 Safari/537.1
Content-Type: application/x-www-form-urlencoded
Accept: application/json, text/javascript, */*; q=0.01
Referer: http://vdisk.weibo.com/file/list
Accept-Encoding: gzip,deflate,sdch
Accept-Language: zh-CN,zh;q=0.8
Accept-Charset: GBK,utf-8;q=0.7,*;q=0.3
Cookie: 省略。。
mfiles=183211891%7C%7C%7CArduino%E7%BC%96%E7%A8%8B%E8%AF%AD%E8%A8%80%E5%8F%82%E8%80%83%E5%A4%A7%E5%85%A8%EF%BC%88%E5%AE%98%E6%96%B9%E7%BD%91%E7%AB%99%EF%BC%89.doc%7C%7C%7C0%2F%2F%2F183211900%7C%7C%7C%E7%94%B5%E8%84%91%E9%94%AE%E7%9B%98%E5%BF%AB%E6%8D%B7%E9%94%AE%E4%B8%80%E8%A7%88.doc%7C%7C%7C0%2F%2F%2F&dest_dirid=0
我已经知道了POST的信息,我现在要在C#上怎么写这个呢?
我是用的webbrowser控件,求一个详细的源码。帮我改改谢谢了!
[解决办法]
亲你真懒
参考
http://www.cnblogs.com/changyou/archive/2010/01/09/1643167.html
http://www.cnblogs.com/swtseaman/archive/2011/10/17/2215717.html
http://hi.baidu.com/%E5%86%B0%E7%81%AB%E6%88%98%E5%9C%B0/blog/item/07e0fce581d19f23b9382079.html
好了。看完差不多你就弄出来了
[解决办法]
楼主看看api吧
[解决办法]
WebRequest req = null; WebResponse rsp = null; string responseMsg = string.Empty; // 创建请求 req = WebRequest.Create( resUrl ); req.Method = "POST"; // Post method req.Timeout = 90 * 1000; // 90秒超时时间 req.ContentType = contentType; // content type var bytes = reqCoding.GetBytes( postData ); var inputStream = req.GetRequestStream(); inputStream.Write( bytes, 0, bytes.Length ); inputStream.Close(); //StreamWriter writer = new StreamWriter( req.GetRequestStream(), reqCoding ); ///// 写入请求报文 //writer.Write( postData ); //writer.Close(); /// 获取响应流 rsp = req.GetResponse(); if ( req != null ) req.GetRequestStream().Close(); if ( rsp != null ) { // 读取响应流 using ( StreamReader sr = new StreamReader( rsp.GetResponseStream(), rspCoding ) ) { responseMsg = sr.ReadToEnd(); } rsp.GetResponseStream().Close(); }