Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parse RSS feed using asp.net c#

Tags:

c#

asp.net

rss

I have an RSS feed that I follow and would like to display it on my website. The UI would simply contain the description of the article in the RSS feed and also have the link to click on.

Since I'm using the ASP.NET C# framework, I'm wondering if this has been done before.

Thanks!

like image 829
locoboy Avatar asked Aug 02 '11 23:08

locoboy


1 Answers

The consumption (and generation) of feeds has been baked into the framework since .NET 3.5 SP1 in the System.ServiceModel.Syndication namespace.

You can consume a feed (ATOM or RSS) using the SyndicationFeed class, like this:

var reader = XmlReader.Create("http://localhost/feeds/serializedFeed.xml");
var feed = SyndicationFeed.Load(reader);

Lots of examples on MSDN - take a look at the namespace page I've linked to. Should get you started.

like image 153
Matt Hamilton Avatar answered Sep 18 '22 01:09

Matt Hamilton