ASP.NET POST方式提交数据
2019-07-30 21:55
971 查看
原文链接:http://www.cnblogs.com/JiangXiaoTian/articles/2694102.html
protected void Page_Load(object sender, EventArgs e) {
} private void getPostAddr(string lon, string lat) { string url = "http://www.ciensharp.com/api/addreq"; string postData = "postStr={" + string.Format("lon:{0},lat:{1},version:1.0.2", lon, lat) + "}&type=geocode"; Encoding encoding = Encoding.UTF8; byte[] data = encoding.GetBytes(postData); //准备请求 HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(url); myRequest.Method = "POST"; myRequest.ContentType = "application/x-www-form-urlencoded"; myRequest.ContentLength = data.Length; Stream stream = myRequest.GetRequestStream(); //发送数据 stream.Write(data, 0, data.Length); stream.Close(); //获取数据 HttpWebResponse res = (HttpWebResponse)myRequest.GetResponse(); StreamReader sr = new StreamReader(res.GetResponseStream(), System.Text.Encoding.UTF8); string backstr = sr.ReadToEnd(); Response.Write(backstr); sr.Close(); res.Close(); }
转载于:https://www.cnblogs.com/JiangXiaoTian/articles/2694102.html
相关文章推荐
- ASP.NET POST方式提交数据
- asp.net 数据提交中的GET,POST, PUT,DELETE,四种方式
- ASP.NET POST方式提交数据!
- ASP.NET POST方式提交数据
- ASP.NET POST方式提交数据
- asp.net使用JS+form表单Post和Get方式提交数据
- asp.net JS+form表单Post和Get方式提交数据
- 在ASP.NET中获取Get方式和Post方式提交的数据
- ASP.Net 提交表单 post 方式代码
- ASP.NET中POST提交数据并跳转页面
- ASP.NET Post方式提交
- ASP.NET 最全的POST提交数据和接收数据
- asp.net post get 数据获取方式
- asp.net中用来进行Post和Get方式提交表单的方法
- 在ASP.NET中获取参数POST和GET方式提交的参数
- ASP.NET GET 方式提交数据!
- 在ASP.NET中获取参数POST和GET方式提交的参数
- Asp.net的post提交方式
- asp.net mvc中的post提交方式
- ASP.NET数据提交POST和GET【小说一下】