Web 2.0 ASP.NET

A Blog about ASP.NET, MVC, Web 2.0, AJAX, SQL server and other web technologies.
Helping the little guy win!

Using The ASP.NET RSS Toolkit to quickly include syndicated content in your own site

Introduction
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.

Possible Problems
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:
http://www.codeplex.com/ASPNETRSSToolkit

Example

Here we simply create an RSS data source for a databound control (in this case a DataGrid).


using RssToolkit.Rss;
using RssToolkit.Web.WebControls;

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;
dgRSS.DataBind();
}
}



kick it on DotNetKicks.com

0 comments:

Now Reading







Disclaimer

All data and information provided in THIS blog is for informational purposes only. I make no representations as to accuracy, completeness, currentness, suitability, or validity of any information on this blog and will not be liable for any errors, omissions, or delays in this information or any losses, injuries, or damages arising from its display or use. All information is provided on an as-is basis. All code may be used under the standard UIIYW BDBMIITDW license (Use It If You Want But Dont Blame Me If It Doesnt Work) :)