CodeKicks.com
Focus on Microsoft Technologies - Tutorials, Articles, Code Samples.

Saturday, September 02, 2006

Creating an RSS Aggregator User Control in ASP.NET

Introduction

RSS is an XML format for syndicating news and content, from major news sites, community and personal weblogs. But it's not just for news. It's able to deliver rich, dynamic content to a website, if you know how to read the RSS XML. The RSS Aggregator takes a lot of the mystery out of decoding RSS feeds.

Background

Since the RSS Aggregator is a Web User Control, it's really just about as simple as creating a new application, adding the control and associated code, and dragging and dropping the control on your site. Of course, you will have to setup a couple of small things in the code (like the source of the feeds), but overall, it should be fairly straightforward. The enclosed example even contains a styled version of the aggregator, so you won't have to spend additional time adding styles.

This version allows you to configure the aggregator to download any number of feeds (though personally, I wouldn't do more than three or four, or you'll notice a significant delay on page load). The display medium is an ASP.NET DataGrid control. The example code implements paging for the grid.

Using the code

The code is pretty well documented, so I won't include a ton of code here (not like anyone will read it anyway! :)). The only code block I'll post will be the simple act of configuring the aggregator to download feeds. The rest is up to you!

The only method you need to configure is the BindFeeds() method. This method is located in the RSSAggregator.ascx.cs code-behind. Just follow the directions in the code, and in no time, you'll have a working RSS Aggregator!

Download and view complete article.

Post a Comment