为了账号安全,请及时绑定邮箱和手机立即绑定

为啥网页不显示post传入的数据

为啥网页不显示post传入的数据

临摹微笑 2018-12-07 04:24:46
1 Encoding encoding = Encoding.GetEncoding("utf-8"); 2 string URL = "http://192.168.1.115/cccn/test_post.php"; 3 string postData = "username" + textBox1.Text.ToString() + "password" + textBox2.Text.ToString(); 4 byte[] data = encoding.GetBytes(postData); 5 HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(URL); 6 myRequest.Method = "POST"; 7 myRequest.ContentType = "application/x-www-form-urlencoded"; 8 myRequest.ContentLength = data.Length; 9 Stream st = myRequest.GetRequestStream(); 10 st.Write(data, 0, data.Length); 11 st.Close(); 12 HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse(); 13 Stream receiveStream = myResponse.GetResponseStream(); 14 StreamReader readStream = new StreamReader(receiveStream, encoding); 15 char[] read = new char[256]; 16 int count = readStream.Read(read, 0, 256); 17 String str = null; 18 while (count > 0) 19 { 20 str += new string(read, 0, count); 21 count = readStream.Read(read, 0, 256); 22 } 23 myResponse.Close(); 24 readStream.Close();
查看完整描述

5 回答

?
慕侠2389804

TA贡献1719条经验 获得超6个赞

楼主好像是提交了数据,但是对于返回的数据也是放到了字符串中,然后也没有显示的操作啊
查看完整回答
反对 回复 2018-12-09
?
慕的地10843

TA贡献1785条经验 获得超8个赞

显示的操作,应该是在网页中。。。
查看完整回答
反对 回复 2018-12-09
  • 5 回答
  • 0 关注
  • 497 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信