.Net’s System.ServiceModel.Syndication / RSS Feeds!

If you’re looking to work with RSS feeds, I suggest you checkout the .net ServiceModel.Syndication. Below is a quick example in .net 4 / VB:

 

Imports System.ServiceModel.Syndication

'In case you're using a proxy:
Dim wReq As HttpWebRequest
wReq = WebRequest.Create("http://yourRSSfeedURL")
wReq.Proxy = WebProxy.GetDefaultProxy
wReq.Proxy.Credentials = CredentialCache.DefaultCredentials
Dim xReader As XmlReader = XmlReader.Create(wReq.GetResponse.GetResponseStream)
'Create the feed from the xml loaded
Dim sFeed As SyndicationFeed = SyndicationFeed.Load(xReader)
'Loop through the results
For Each sItem As SyndicationItem In sFeed.Items
  Debug.WriteLine(sItem.Title.Text) 'Many other SyndicationItem properties available!
Next

I have compared this to other libraries and this by far is the cleanest / easiest way to pull in RSS Feeds. What are your thoughts?

.Net’s System.ServiceModel.Syndication / RSS Feeds!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s