How to

download and parse RSS feed

Published: 28. December 2014 | Updated: 28. December 2014
License: Microsoft Public License (MS-PL)
Categories: Network
Tags: C# Network Text XML
Was this snippet helpful for you? YESYES / NONO
Get Analyzant!

Check your entire website from code to content in minutes with Analyzant, the free analysis suite.

Free download at analyzant.com

Import namespaces

using System.IO;
using System.Net;
using System.ServiceModel.Syndication;
using System.Xml;

Code

public static SyndicationFeed DownloadFeed(string url)
{
    using (var client = new WebClient())
    {
        var content = client.DownloadString(url);
        using (var stringReader = new StringReader(content))
        {
            using (var reader = new XmlTextReader(stringReader))
            {
                return SyndicationFeed.Load(reader);
            }
        }
    }
}
Send us feedback about this snippet »



Related Snippets: