c# httpwebrequest form1表单的模拟提交问题

susongbin 2007-09-05 11:41:35
我用C#写的应用程序,想通过此程序得到我想要的的手机归属地信息,数据感觉是有传出去,可是返回的结果页面却没有动态的内容.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.IO;

namespace WindowsApplication8
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
string mobilenum = textBox1.Text;
string updata = "mobile=" + mobilenum+"&B1=查询";
ASCIIEncoding asc = new ASCIIEncoding();
byte[] data = asc.GetBytes(updata);
HttpWebRequest hwr = (HttpWebRequest)WebRequest.Create("http://www.ip138.com:8080/search.asp");
hwr.ContentType = "application/x-www-form-urlencoded";
hwr.ContentLength = data.Length;
hwr.Method = "POST";
Stream str = hwr.GetRequestStream();
str.Write(data, 0, data.Length);
HttpWebResponse hw = (HttpWebResponse)hwr.GetResponse();
Stream sr = hw.GetResponseStream();
StreamReader streamread = new StreamReader(sr, Encoding.Default);
string message=streamread.ReadToEnd();
this.webBrowser1.DocumentText = message;






}
}
}
...全文
488 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
susongbin 2007-09-06
  • 打赏
  • 举报
回复
急啊,没人回答啊
zhw2ll 2007-09-06
  • 打赏
  • 举报
回复
同样的问题。。。帮顶

111,094

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧