Using RSS Feed in your web page RRS feed

  • Question

  • User2129316869 posted

    Please I am helping a friend on a news resource center and we need to grab news from different providers that support RSS feed and fix it in our web pages. Please how can I do this.

    Monday, May 19, 2014 6:36 AM


All replies

  • User2129316869 posted

    To be more precise. Any idea on using the Syndicate class for razor.

    Monday, May 19, 2014 7:29 AM
  • User2129316869 posted

    I have tried using this method http://www.mikesdotnetting.com/Article/209/Consuming-Feeds-And-Web-Services-In-Razor-Web-Pages but nothing was displayed.

    This is my code

    @using System.Xml.Linq
    @using System.Xml
    @using System.ServiceModel.Syndication;
        Layout = "_SiteLayout.cshtml";
        var feed = XDocument.Load("http://www.medicalnewstoday.com/rss/acidreflux-gerd.xml");
        XNamespace xmlns = "http://www.w3.org/2005/Atom";
        var items = feed.Descendants(xmlns + "entry").Select(item => new {
            Title = item.Element(xmlns + "title").Value,
            Published = item.Element(xmlns + "published").Value,
            Author = item.Element(xmlns + "author").Element(xmlns + "name").Value
    @foreach (var item in items) {
        <p><strong>@item.Author</strong><br />
            @item.Title<br />
        var feed2 = SyndicationFeed.Load(new XmlTextReader("http://www.medicalnewstoday.com/rss/acidreflux-gerd.xml"));
    Just that one line of code is required to enable you to render the contents:
    @foreach (var item in feed2.Items) {
    Monday, May 19, 2014 7:40 AM
  • User2129316869 posted

    As I was unable to fix the RSS thing using Razor, I realized I could use a Client side option with JQuery and with the help of a plugin. If interested visit http://www.zazar.net/developers/jquery/zrssfeed/# . Thanks

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, May 19, 2014 12:17 PM