In This Chapter:
At times, you will need to request data from other Web servers within your ASP.NET application. At first, this idea might seem strange. After all, we have been talking about using Web services to get data from other servers. Although Web services are extremely useful and represent the current recommended way for obtaining data from other servers, not all servers will offer Web services to your application.
For instance, a page on another server might present data or information of some sort, and you would like to retrieve this information for use in your application. If this is an older server that does not support Web services, you might need to employ some more pedestrian data-retrieval methods. Essentially, you would request the Web page in which the data resides, then you would process the Web page and extract the data. This technique is commonly known as data scraping, in which you retrieve a Web page and extract data that you would like to use in your application. One important note, though, is that you must have permission before you can legally scrape data from another Web site. Make sure, before you use data from someone else's Web site, that you have the necessary permissions.
The System.Net namespace provides a simple programming interface to many of the protocols found in today's networks. This namespace includes WebRequest, WebResponse, Dns, WebProxy, and many other types of classes with which you can easily write networking applications. This namespace enables you to develop applications that use Internet resources, and the classes encapsulate them in such a way that you don't have to worry about the specific details of doing the networking. Table 13.1 gives a brief description of these classes.