Creating RSS Feeds Using ASP.Net
Kevin Miller
February 6, 2009

Warning: This is one of those late to the party posts where I show off some cool thing that everyone already likely knows about. I just feel special right now because I was able to push out something we’ve wanted to do for quite some time in an afternoon.

 

We wanted to have an RSS feed so customers could keep up to date with new or recently updated Dovetail Knowledge Base articles. My personal mental gate was that I really didn’t want to try to figure out how to properly create an RSS or Atom feed and I didn’t want to bother with complex heavy handed frameworks like Argotic. Then one day Joshintroduced me to the System.ServiceModel.Syndication namespace (introduced in .Net 3.5) and my life was never the same.

 

Simple stuff really. Create a SyndicatedFeed filled with feed items and hand that to a Feed Formatter.

Generating an RSS feed

 

 

But I get ahead of myself. We have to serve this feed from somewhere. Not really being an ASP.Net expert Josh got me started with a Generic Handler.

 

image

Which seems a thin construct for simply spiting content out of a URL. Perfect.

A Syndication Feed

 

To build the syndication I created this little helper method.

Assembling a Syndication Item

 

I’ll skip the gory Dovetail SDK data access code that goes out to the Clarify database and materializes *poof* any solutions that have been created or modified in the last 30 days. Unless, of course, one of my 2 readers asks nicely for it. The interesting bit in any case is that it basically loops over all the solutions found and assembles a Syndication Item for each one.

 

Results

The end result is a totally hard coded HTTP Handler generating an hopefully useful RSS feed for Dovetail’s customers.

 

Dovetail KB feed

 

Next up was to add a meta link to the feed in the html header of our knowledgebase pages. This makes the little RSS icon shows in the address bar of honest and decent hard working web browsers.

 

 

MTE2Mi1pbWFnZV90aHVtYl8xMzY0MTJDNi5wbmc=

Leave a Comment

International: +1 (512) 610-5400
Toll Free: 1 (800) 684-2055