<p>How would you reccommend handling RSS Feeds in ASP.NET MVC?  Using a third party library?  Using the RSS stuff in the BCL?  Just making an RSS view that renders the XML?  Or something completely different?</p>

[{'answer_id': 11920, 'author': 'Dale Ragan', 'author_id': 1117, 'author_profile': 'https://Stackoverflow.com/users/1117', 'pm_score': 7, 'selected': True, 'text': '<p>Here is what I recommend:</p>\n\n<ol>\n<li>Create a class called RssResult that\ninherits off the abstract base class\nActionResult.</li>\n<li>Override the ExecuteResult method.</li>\n<li>ExecuteResult has the ControllerContext passed to it by the caller and with this you can get the data and content type.</li>\n<li><p>Once you change the content type to rss, you will want to serialize the data to RSS (using your own code or another library) and write to the response.</p></li>\n<li><p>Create an action on a controller that you want to return rss and set the return type as RssResult.  Grab the data from your model based on what you want to return.</p></li>\n<li><p>Then any request to this action will receive rss of whatever data you choose.</p></li>\n</ol>\n\n<p>That is probably the quickest and reusable way of returning rss has a response to a request in ASP.NET MVC.</p>\n'}, {'answer_id': 12002, 'author': 'Haacked', 'author_id': 598, 'author_profile': 'https://Stackoverflow.com/users/598', 'pm_score': 4, 'selected': False, 'text': "<p>Another crazy approach, but has its advantage, is to use a normal .aspx view to render the RSS. In your action method, just set the appropriate content type. The one benefit of this approach is it is easy to understand what is being rendered and how to add custom elements such as geolocation.</p>\n\n<p>Then again, the other approaches listed might be better, I just haven't used them. ;)</p>\n"}, {'answer_id': 13662, 'author': 'Ricky', 'author_id': 653, 'author_profile': 'https://Stackoverflow.com/users/653', 'pm_score': 5, 'selected': False, 'text': '<p>I agree with Haacked. I am currently implementing my site/blog using the MVC framework and I went with the simple approach of creating a new View for RSS:</p>\n\n<pre><code>&lt;%@ Page ContentType="application/rss+xml" Language="C#" AutoEventWireup="true" CodeBehind="PostRSS.aspx.cs" Inherits="rr.web.Views.Blog.PostRSS" %&gt;&lt;?xml version="1.0" encoding="utf-8"?&gt;\n&lt;rss version="2.0"&gt;\n&lt;channel&gt;\n&lt;title&gt;ricky rosario\'s blog&lt;/title&gt;\n&lt;link&gt;http://&lt;%= Request.Url.Host %&gt;&lt;/link&gt;\n&lt;description&gt;Blog RSS feed for rickyrosario.com&lt;/description&gt;\n&lt;lastBuildDate&gt;&lt;%= ViewData.Model.First().DatePublished.Value.ToUniversalTime().ToString("r") %&gt;&lt;/lastBuildDate&gt;\n&lt;language&gt;en-us&lt;/language&gt;\n&lt;% foreach (Post p in ViewData.Model) { %&gt;\n    &lt;item&gt;\n    &lt;title&gt;&lt;%= Html.Encode(p.Title) %&gt;&lt;/title&gt;\n    &lt;link&gt;http://&lt;%= Request.Url.Host + Url.Action("ViewPostByName", new RouteValueDictionary(new { name = p.Name })) %&gt;&lt;/link&gt;\n    &lt;guid&gt;http://&lt;%= Request.Url.Host + Url.Action("ViewPostByName", new RouteValueDictionary(new { name = p.Name })) %&gt;&lt;/guid&gt;\n    &lt;pubDate&gt;&lt;%= p.DatePublished.Value.ToUniversalTime().ToString("r") %&gt;&lt;/pubDate&gt;\n    &lt;description&gt;&lt;%= Html.Encode(p.Content) %&gt;&lt;/description&gt;\n    &lt;/item&gt;\n&lt;% } %&gt;\n&lt;/channel&gt;\n&lt;/rss&gt;\n</code></pre>\n\n<p>For more information, check out (shameless plug) <a href="http://rickyrosario.com/blog/creating-an-rss-feed-in-asp-net-mvc" rel="noreferrer">http://rickyrosario.com/blog/creating-an-rss-feed-in-asp-net-mvc</a></p>\n'}, {'answer_id': 433167, 'author': 'Eran Kampf', 'author_id': 1228206, 'author_profile': 'https://Stackoverflow.com/users/1228206', 'pm_score': 7, 'selected': False, 'text': '<p>The .NET framework exposes classes that handle syndation: SyndicationFeed etc.\nSo instead of doing the rendering yourself or using some other suggested RSS library why not let the framework take care of it?</p>\n\n<p>Basically you just need the following custom ActionResult and you\'re ready to go:</p>\n\n<pre><code>public class RssActionResult : ActionResult\n{\n    public SyndicationFeed Feed { get; set; }\n\n    public override void ExecuteResult(ControllerContext context)\n    {\n        context.HttpContext.Response.ContentType = "application/rss+xml";\n\n        Rss20FeedFormatter rssFormatter = new Rss20FeedFormatter(Feed);\n        using (XmlWriter writer = XmlWriter.Create(context.HttpContext.Response.Output))\n        {\n            rssFormatter.WriteTo(writer);\n        }\n    }\n}\n</code></pre>\n\n<p>Now in your controller action you can simple return the following:</p>\n\n<pre><code>return new RssActionResult() { Feed = myFeedInstance };\n</code></pre>\n\n<p>There\'s a full sample on my blog at <a href="http://www.developerzen.com/2009/01/11/aspnet-mvc-rss-feed-action-result/" rel="noreferrer">http://www.developerzen.com/2009/01/11/aspnet-mvc-rss-feed-action-result/</a></p>\n'}, {'answer_id': 15932384, 'author': 'TheDev6', 'author_id': 697660, 'author_profile': 'https://Stackoverflow.com/users/697660', 'pm_score': 3, 'selected': False, 'text': '<p>I got this from Eran Kampf and a Scott Hanselman vid (forgot the link) so it\'s only slightly different from some other posts here, but hopefully helpful and copy paste ready as an example rss feed.</p>\n\n<p><a href="http://achadwick.com/Blog/Result/MVC%20RSS%20Feed" rel="nofollow noreferrer">From my blog</a></p>\n\n<p><a href="http://www.developerzen.com/2009/01/11/aspnet-mvc-rss-feed-action-result/" rel="nofollow noreferrer">Eran Kampf</a></p>\n\n<pre><code>using System;\nusing System.Collections.Generic;\nusing System.ServiceModel.Syndication;\nusing System.Web;\nusing System.Web.Mvc;\nusing System.Xml;\n\nnamespace MVC3JavaScript_3_2012.Rss\n{\n    public class RssFeed : FileResult\n    {\n        private Uri _currentUrl;\n        private readonly string _title;\n        private readonly string _description;\n        private readonly List&lt;SyndicationItem&gt; _items;\n\n        public RssFeed(string contentType, string title, string description, List&lt;SyndicationItem&gt; items)\n            : base(contentType)\n        {\n            _title = title;\n            _description = description;\n            _items = items;\n        }\n\n        protected override void WriteFile(HttpResponseBase response)\n        {\n            var feed = new SyndicationFeed(title: this._title, description: _description, feedAlternateLink: _currentUrl,\n                                           items: this._items);\n            var formatter = new Rss20FeedFormatter(feed);\n            using (var writer = XmlWriter.Create(response.Output))\n            {\n                formatter.WriteTo(writer);\n            }\n        }\n\n        public override void ExecuteResult(ControllerContext context)\n        {\n            _currentUrl = context.RequestContext.HttpContext.Request.Url;\n            base.ExecuteResult(context);\n        }\n    }\n}\n</code></pre>\n\n<p>And the Controller Code....</p>\n\n<pre><code>    [HttpGet]\npublic ActionResult RssFeed()\n{\n    var items = new List&lt;SyndicationItem&gt;();\n    for (int i = 0; i &lt; 20; i++)\n    {\n        var item = new SyndicationItem()\n        {\n            Id = Guid.NewGuid().ToString(),\n            Title = SyndicationContent.CreatePlaintextContent(String.Format("My Title {0}", Guid.NewGuid())),\n            Content = SyndicationContent.CreateHtmlContent("Content The stuff."),\n            PublishDate = DateTime.Now\n        };\n        item.Links.Add(SyndicationLink.CreateAlternateLink(new Uri("http://www.google.com")));//Nothing alternate about it. It is the MAIN link for the item.\n        items.Add(item);\n    }\n\n    return new RssFeed(title: "Greatness",\n                       items: items,\n                       contentType: "application/rss+xml",\n                       description: String.Format("Sooper Dooper {0}", Guid.NewGuid()));\n\n}\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/11915', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/571/']