This article uses C # and .NET provided classes to easily create a program that captures the content source code of the web page content. HTTP is one of the basic protocols of the WWW for data access. Two object classes are provided in the basic type library class of .NET: HTTPWebRequest and HttpWebResponse are used to send requests and respond to a resource. In order to get the content of a resource, let's first specify the URL address you want to grab, request the HTTPWebRequest object, with the HTTPWebResponse object to receive the result of the response, finally use the TextStream object to extract the information we want, and print on the console come out. Let's take a look at how to achieve this function: Step 1: Open vs.net, click "File" - "New" - "Project", Project Type Select "Visual C # item", template selection "Windows Application", Step 2: Add Label1, Button1, TextBox1, TextBox2 four controls in Form1, change the multiline property of TextBox2 to TRUE, step 3: Click Right click on the Form1 form, select "View Code", then enter: Using system.io; using system.text; Enter the following code between private void button1_click (object sender, system.eventargs e) {}: Byte [] buf = new byte [38192]; HttpWebRequest request = (HttpWebRequest) WebRequest.Create (textBox1.Text); HttpWebResponse response = (HttpWebResponse) request.GetResponse (); Stream resStream = response.GetResponseStream (); int count = resStream.Read (buf, 0, buf.Length ); TextBox2.text = encoding.default.getstring (buf, 0, count); relatream.close (); fourth step: Point "Save All" button, press "F5" to run the application, "Please enter the URL address : "Enter http://lucky.myrice.com/down.htm after the next single line text box, click" Get HTML Code "button, you can see the code of the address! Below, we make an analysis on the above procedure: The function of this program is to capture the contents of the web page http://lucky.myrice.com/down.htm, and display HTML code in the multi-line text box, Since the returned data is byte type, we create an array variable called BUF byte type to store the result returned, where the size of the array is related to the size of the data we have to request. First, we instantiate the HTTPWebRequest object, using the static method of the WebRequest class Create (), the string parameter of this method is the URL address we have to request the page, because the create () method returns a WebRequest type, we must do it Model (ie type conversion) is httpwebRequest type, and then assign it to the Request variable.