A Tabbed Interface Web Browser

 

Other Ways to Work with Web Data

Earlier, I mentioned that you could use a WebBrowser control for screen scraping, a practice in which you gather the text of a Web Form and parse through it to retrieve a single value. For instance, you might use screen scraping on a search engine page to leverage the power of a search engine within the application.

In practice, there are problems with this approach. First, your code often relies on the exact layout of the page you are scraping. If the page design changes, it is possible that your code will be unable to find what it is looking for. A bigger issue is that, to retrieve a single fact from a page, the entire page must be downloaded. For example, I know of authors who have developed applications to access a Web page on a book seller's site to get the current sales rank of their book. This code retrieves a rather large page for one bit of information.

Some Web site developers recognize the value of other developers accessing their content. In some cases, Web site developers see a way to gather additional revenue, and in other cases, they expect that the increase in "mind share" among developers will help them in other areas. Seeing this, many Web sites have developed new APIs that use Web services to provide information that other developers can use within their applications. In addition to supporting Web services supplied by other vendors, ASP.NET provides good support for creating custom Web services. Web services provide a standard way for sending information from a Web server to your application. By using ASP.NET Web services, you could easily send a DataSet object from a Web service to your Windows Forms application.

Tip 

As mentioned in Chapter 5, "Data Binding", using a DataSet object to a Web service, or retrieving one from a Web service, may not be a practical idea. First, the overhead associated with a DataSet object degrades performance significantly. Also, transferring a DataSet ties you to .NET for both the client and for the Web service, sacrificing interoperability (a key goal when developing Web services).

Web services is a topic beyond the scope of this book. However, it is covered in the book Building XML Web Services for the Microsoft .NET Platform, by Scott Short (Microsoft Press, 2002).

 


Programming Microsoft Web Forms
Programming Microsoft Web Forms (Pro Developer)
ISBN: 0735621799
EAN: 2147483647
Year: 2005
Pages: 70

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net