Post提交数据
来源:互联网 发布:mysql导出表数据 编辑:程序博客网 时间:2024/06/05 18:25
//提交方法private void GetIMG(string url, string html) { HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(url); //需要一个String暂存HTML的值 string postdata = html; //头部(动态) Encoding encode = System.Text.Encoding.GetEncoding("utf-8"); byte[] arrB = encode.GetBytes(postdata); myRequest.Method = "POST"; myRequest.ContentType = "text/html";//x-www-form-urlencoded//ContentType需要对应页面相应类型 myRequest.ContentLength = arrB.Length; Stream outStream = myRequest.GetRequestStream(); outStream.Write(arrB, 0, arrB.Length); outStream.Close(); HttpWebResponse HttpWResp; try { HttpWResp = (HttpWebResponse)myRequest.GetResponse(); } catch (WebException ex) { HttpWResp = (HttpWebResponse)ex.Response; } }//接收页面 protected string postStr; protected void Page_Load(object sender, EventArgs e) { if (Request.HttpMethod.ToLower() == "post") { Stream stream = System.Web.HttpContext.Current.Request.InputStream; byte[] b = new byte[stream.Length]; stream.Read(b, 0, (int)stream.Length); postStr = Encoding.UTF8.GetString(b); HtmlToImg.Html = postStr; } if (HtmlToImg.Html != null) //htmlToImage.Html 为静态方法 { postStr = HtmlToImg.Html; } }//绑定数据源<div style="margin-left: -18px; margin-top: -16px;"> <%=postStr%> </div>
0 0
- post提交数据
- c#post数据提交
- http post提交数据
- POST提交数据
- 使用POST提交数据
- android Post提交数据
- http post提交数据
- post提交数据
- POST提交JSON数据
- POST提交数据
- post提交数据
- C++POST提交数据
- $.post 提交数据
- android post提交数据
- Post 提交数据
- POST 提交数据方式
- Post提交数据
- post提交数据
- 让程序在崩溃时体面的退出之Dump文件
- 【iOS开发】UIViewController之间的切换动画效果
- 常用消息短文本
- 欢迎使用CSDN-markdown编辑器
- Android网络基础之HTTP协议原理
- Post提交数据
- ubuntu 12.04 升级到 14.04
- linux c之使用mprotect检测内存访问
- .NET访问数据库常用的数据库助手类
- 背包问题-泛化物品
- 合并果子(堆写法)
- 强悍的 Linux —— ssh
- 整数划分问题递归算法
- ios 内存使用陷阱 和imageNamed 、imageWithContentsOfFile: