GetURLHtml. aspx
<% @ Page language = "c #" Codebehind = "GetURLHtml. aspx. cs "Src =" GetURLHtml. aspx. cs "AutoEventWireup =" false "Inherits =" Lion. web. forum. webForm1 "%>
<HTML>
<HEAD>
<Title> Lion interactive network => use the WebClient and WebRequest classes to obtain the webpage Source Code </title>
<META http-equiv = "Content-Type" content = "text/html; charset = gb2312">
</HEAD>
<Body>
<Form runat = "server">
<Asp: TextBox id = "UrlText" runat = "server" Width = "50%"> http://www.lionsky.net/mywebsite/index.aspx </asp: TextBox>
<Asp: Button id = "Button1" runat = "server" Text = "Get With WebClient"> </asp: Button> & nbsp;
<Asp: Button id = "Button2" runat = "server" Text = "Get With WebRequest"> </asp: Button> <BR>
<Asp: TextBox id = "ContentHtml" runat = "server" Width = "100%" Height = "360px" TextMode = "MultiLine"> </asp: TextBox>
</Form>
</Body>
</HTML>
GetURLHtml. aspx. Cs
Using System;
Using System. Collections;
Using System. ComponentModel;
Using System. Data;
Using System. Drawing;
Using System. Web;
Using System. Web. SessionState;
Using System. Web. UI;
Using System. Web. UI. WebControls;
Using System. Web. UI. HtmlControls;
Namespace Lion. Web. Forum
{
/// <Summary>
/// Summary of WebForm1.
/// </Summary>
Public class WebForm1: System. Web. UI. Page
{
Protected System. Web. UI. WebControls. TextBox TextBox1;
Protected System. Web. UI. WebControls. Button Button1;
Protected System. Web. UI. WebControls. Button Button2;
Protected System. Web. UI. WebControls. TextBox UrlText;
Protected System. Web. UI. WebControls. TextBox ContentHtml;
Protected System. Web. UI. WebControls. TextBox TextBox2;