November 2001
Beginner to intermediate
816 pages
16h 3m
English
The System.Net namespace contains several classes to make working with the HTTP protocol easier. HTTP is the standard protocol for communicating on the World Wide Web, often just called the Web. The examples in this section use the HTTP classes to create a program that obtains a Web page. Listing 24.3 uses the HttpWebRequest, HttpWebResponse, and HttpStream classes to obtain a Web page.
using System; using System.IO; using System.Net; using System.Text; /// <summary> /// Reads a Web page. /// </summary> class SiteReader { static void Main(string[] args) { try { ASCIIEncoding ASCII = new ASCIIEncoding(); byte[] buf = new byte[2048]; HttpWebRequest httpReq = (HttpWebRequest)WebRequest.Create( ... |
Read now
Unlock full access