HttpWebRequest查看网页源代码,详见截图
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
// 定义私有变量。
public HttpWebRequest req;
public HttpWebResponse res;
public Stream s;
public StreamReader r;
// 发送Http请求并接收Http应答
private void button1_Click(object sender, System.EventArgs e)
{
if(textBox1.Text.Length != 0)
{
button1.Enabled = false;
req = (HttpWebRequest)WebRequest.Create(textBox1.Text);
res = (HttpWebResponse)req.GetResponse();
s = res.GetResponseStream();
r = new StreamReader(s);
richTextBox1.Text = r.ReadToEnd();
r.Close();
s.Close();
res.Close();
button1.Enabled = true;
}
}
资源文件列表
HTTP/App.ico , 1078
HTTP/AssemblyInfo.cs , 1846
HTTP/bin/Debug/Http.exe , 8192
HTTP/bin/Debug/Http.pdb , 13824
HTTP/Form1.cs , 4309
HTTP/Form1.resx , 5315
HTTP/Http.csproj , 4361
HTTP/Http.csproj.user , 1774
HTTP/Http.sln , 904
HTTP/Http.suo , 7168
HTTP/obj/Debug/Http.exe , 8192
HTTP/obj/Debug/Http.exe.incr , 1520
HTTP/obj/Debug/Http.Form1.resources , 324
HTTP/obj/Debug/Http.pdb , 13824
HTTP/obj/Debug/Http.projdata , 5384
