This being the age of the mash up, those of you who have yet to hear about RSS have been living under a rock! RSS (Really Simple Syndication) is the syndication weapon of choice for most blogs and feeds.
For those of you who are delving into the possibilities of utilising syndicated content in ASP.NET, the ASP.NET RSS Toolkit is a very powerful yet simple tool which will help you quickly integrate content syndicated from other sites.
Why the RSS Toolkit?
Simply put, why reinvent the wheel? I am not one to look a gift horse in the mouth, so when I am presented with a solution which works, you won’t find me asking too many questions. Not so simply put, there are a bunch of solutions out there which do the same job, but, in my humble opinion not quite as well rounded as the RSS Toolkit. At a basic level it provides a very simple interface to provide RSS content to databound controls, not only that but you can also automatically create strongly typed objects for different feeds by using it’s very clever command line utility.
As always, nothing is perfect and the RSS Toolkit currently doesn’t handle RSS feeds which use the Dublin Core meta data specification, but as most of the big blogs and feeds don’t use it for my book this is a small price to pay. Other problems I often read people moaning about are applications which break when the feed is unavailable. This, my friends, is self inflicted and actually bad programming. Rule one is checking that resources exist before trying to use them and of course putting try catch blocks around code which may potentially break under some circumstances, in this case an RSS feed being unavailable, should go without saying (I said it anyway) just to be sure.
Shut up and give me the code!
Not mine to give, but you can snag a copy over at codeplex:
Here we simply create an RSS data source for a databound control (in this case a DataGrid).
public partial class FeedTest : System.Web.Page
protected void Page_Load(object sender, EventArgs e)
RssDataSource rds = new RssDataSource();
rds.Url = “your choice of feed url goes here”
dgRSS.DataSource = rds;