winform中使用post方式传送zip数据包
来源:互联网 发布:江苏专业网络推广公司 编辑:程序博客网 时间:2024/05/16 13:57
winform项目中,需要和服务器端接口做数据交换,利用post方式传送zip数据包,包中是压缩的.xml文件.
主要代码实现如下:
//发送
HttpWebRequest httpRequest = WebRequest.Create(string.Format("http://{0}:{1}{2}", __ServerIP, __ServerPort, __ServerVATUP)) as HttpWebRequest;
httpRequest.KeepAlive = true;
httpRequest.ContentType = "text/html";
httpRequest.ContentLength = ArrInvoiceSend.Length;
httpRequest.Headers["NSR"] = __RPID;
httpRequest.Headers["PWD"] = __RPPassword;
httpRequest.Headers["NSRSBH"] = hash["BuyerTaxCode"].ToString();
httpRequest.Headers["FORMAT"] = "zip";
httpRequest.ProtocolVersion = new Version("1.0");
httpRequest.UserAgent = "Mozilla/3.0 (compatible;Indy library) ";
httpRequest.Accept = "text/html, */*";
httpRequest.Method = "POST";
httpRequest.Timeout = 1000000;
//获得后台设置的代理,指定http代理
//WebProxy proxy = new WebProxy("uri", 800);
//proxy.Credentials = new NetworkCredential("username", "password");
//httpRequest.Proxy = proxy;
using (System.IO.Stream requestStream = httpRequest.GetRequestStream())
{
requestStream.Write(ArrInvoiceSend, 0, ArrInvoiceSend.Length);
requestStream.Flush();
}
using (WebResponse response = httpRequest.GetResponse())
{
string strResult = response.Headers["result"];
//处理返回的结果数据...
- winform中使用post方式传送zip数据包
- 前端学习——使用Ajax方式POST JSON数据包
- post和get传送方式区别
- POST以流的方式传送文件
- Jquery ajax 使用处理 post方式传送 text 定界符使用
- HTTPS的POST登录数据包方式
- Asterisk中rtp传送方式
- WCF中REST使用POST方式
- Python中使用POST方式上传文件
- Python中使用POST方式上传文件
- Python中使用POST方式上传文件
- Python中使用POST方式上传文件
- GET与POST比较-使用HTTP协议将客户端的请求传送到服务器端的两种方式
- 解决juqery ajax post方式传送数据乱码问题
- 数据传送三种方式(post、get、ajax)
- winform下通过webclient使用非流方式上传(post)数据和文件
- 使用HyperLink传送值的方式
- 使用POST方式请求
- HDU 2065
- Ubuntu安装时没注册root用户密码,怎么登录root
- larbin 编译成功后做什么
- zen cart 函数大全
- 快速排序(java版)
- winform中使用post方式传送zip数据包
- java都是值传递 测试
- Integrating asynchronous JMS processing in Oracle ADF Applications
- 【转】Weka使用笔记
- 从此我不再纠结于算法了
- 【转】Weka学习笔记
- 关于ADF的热部署
- 如何为ORACLE表空间或临时表空间增加数据文件?
- 优化必不可少--看懂SqlServer查询计划