Using SyndicationFeed to display photos from

The SyndicationFeed class from System.ServiceModel.Syndicatation makes it easy to work with feeds and extensions. The code below uses an RSS feed from to show photo albums on a page.  Of course there are many ways to consume RSS with and w/o code, but the WCF enhancements with .NET 3.5 are a nice new trick. You can see the result at

r = XmlReader.Create("");
albums = SyndicationFeed.Load(r);
foreach (SyndicationItem album in albums.Items)

// album.links[0].URI points to this album page on
// album.Summary (not shown) is an HTML block with thumbnails of the album pics
cell.Text= string.Format("<a href='{0}'>{1}</a>", album.Links[0].Uri, album.Title.Text);
albumRSS = GetAlbumRSS(album);
r = XmlReader.Create(albumRSS);
photos = SyndicationFeed.Load(r);
foreach (SyndicationItem photo in photos.Items)
// photo.Summary is an HTML block with a thumbnail of the pic
      cell.Text = string.Format("{0}", photo.Summary.Text);

// helper to extract the feed to one album from the albums feed
private string GetAlbumRSS(SyndicationItem album)

string url = "";
foreach (SyndicationElementExtension ext in album.ElementExtensions)
       if (ext.OuterName == "itemRSS") url = ext.GetObject<string>();
return (url);


Comments (5)
  1. Kathirvel says:

    Hi Steve,

    I want to validate RSS feed url given by the user programmatically. Ofcourse, there are lot of web sites they do validate rss feeds…like"RSS Feed uRL"…it will validate and tell you the results.

    But i want to do programmatically using .NET …so is there any API is available….it would be great if you help in this regard.

    Thanks & Regards,


  2. Ashokraj says:

    Exception while reading r = XmlReader.Create("…/feed.rss");

    How can i give Proxy (407) Proxy Authentication Required

  3. v srinivas says:

    very helpful code. it helped me a lot.

  4. says:

    Ashokraj we use webclient to solve this issue.

    using (WebClient client = new WebClient())


                   //set your proxy to client here

                   string data = client.DownloadString(url);

                   using (XmlReader reader = XmlReader.Create(new StringReader(data)))


                       SyndicationFeed feed = SyndicationFeed.Load(reader);

                       foreach (SyndicationItem item in feed.Items)


                           String subject = item.Title.Text;

                           Console.WriteLine("{0}" , subject);




Comments are closed.

Skip to main content