HttpWebRequest can make asynchronous calls to
web services, including requests
for syndication feeds.
the simpler of the two class libraries as it uses
HttpWebRequest under the covers. Using one of
these classes to make a web request for a syndicated feed, you can
retrieve the data as a string or as a stream, depending on what you desire. The examples
in this chapter demonstrate techniques with both classes and both return
The first step in requesting a feed is to find the feed’s URI. Many websites publish their syndication feed address in a conspicuous spot on their web page. The format of the feed may be either RSS or Atom. Because both of these protocols are commonly used, any code that requests a feed should be prepared to work with either RSS or Atom. For the following examples, the http://feeds.feedburner.com/johnpapa feed will be requested.
The code solution for the following example is named
SyndicationReader and you can find it in the
code folder for this chapter.
The example application (shown in Figure 10-2) will request a feed from an
address that the user enters. When the feed is returned, it is loaded
SyndicationFeed object and is
bound to the control, where it displays information about the feed and
its individual items.
application allows the user to choose between using
HttpWebRequest. Although a real-world application targeted at nondevelopers would likely not ...