Click here to Skip to main content
13,861,260 members
Click here to Skip to main content
Add your own
alternative version


7 bookmarked
Posted 27 Dec 2012
Licenced CPOL

Creating an RSS 2.0 Feed with .NET Syndication Namespace

, 27 Dec 2012
Rate this:
Please Sign up or sign in to vote.
A .NET programming article including code showing how to create a compliant RSS 2.0 feed using .NET Syndication Namespaces


In my previous post, I demonstrated how to create an RSS feed using an XML Document.

This got some attention as it was pointed out to me that I could achieve the same result using the .NET Syndication classes. As a result, I have created this programming article with an alternate version of the class, which does away with the XMLDocument manipulation and uses these Syndication classes.

As with any default namespaces and classes in the .NET Framework, they expose a lot of things that I quite simply don't need for my simple News or Article RSS feed, so I have wrapped them up as I did last time into a utility class, which enables you to quickly and easily create your feed.

Using the Code

The code is available for download here, simply put it into your project and add a reference to yourprojectnamespace.Syndication. Using the code is very simple, see this example:

'Create your feed
Dim rssfeed As New RSSFeed("Your RSS Feed Title",
                           "The description of your feed",
                           "The URL to the feed",
                           "A unique identifier for your feed",

'Add a category to the main channel
rssfeed.AddFeedCategory("CodeProject", "", "CodeProject")

'Add an item
dim item = rssfeed.AddItem("Item Title",
                           "Item Description",
                           "Item Body",
                           "Item URL",
                           "A unique identifier for your item",
                           "The author name")

'Add a category to the item
item.Categories.Add(New SyndicationCategory("CodeProject","","CodeProject"))

'Output the result
Return Content(rssfeed.ToString(rssfeed.OutputType.RSS2), "text/xml")


Because we're now using the syndication provider, you can choose to output as RSS2 or Atom1 by changing the parameter in the ToString method.

This is utilizing the helper class as previous to ensure the XML document is UTF8, the resultant XML passes the RSS Feed Validator, and works perfectly with Code Project.

As usual, any questions, please ask.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Karl Stoney
Architect Hewlett Packard Enterprise Security Services
United Kingdom United Kingdom
Technical Architect for Hewlett-Packard Enterprise Security Service.

Please take the time to visit my site

You may also be interested in...


Comments and Discussions

GeneralMy vote of 4 Pin
Savalia Manoj M21-Jan-13 3:50
memberSavalia Manoj M21-Jan-13 3:50 
GeneralMy vote of 5 Pin
Mihai MOGA15-Jan-13 7:54
professionalMihai MOGA15-Jan-13 7:54 
GeneralRe: My vote of 5 Pin
Karl Stoney15-Jan-13 7:54
memberKarl Stoney15-Jan-13 7:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web02 | 2.8.190214.1 | Last Updated 28 Dec 2012
Article Copyright 2012 by Karl Stoney
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid