私はASP.net MVCサイトからRSSフィードを提供しようとしています。すべてがpubdate要素の受け入れを行っています。私はそれを出力するRss20FeedFormatterを取得するように見えることはできません。私はそれがSyndicationFeedオブジェクトのLastUpdatedDateプロパティにマップされていると考えましたが、LastBuildDateとして出力します。RSS SyndicationFeed APIを使用してpubDateをレンダリング
RssFeedFormatterでSyndicationFeedを使用して、RssFeedにpubDateノードをレンダリングする方法を知っている人はいますか?
public class RssActionResult : ActionResult
{
public SyndicationFeed Feed { get; set; }
public override void ExecuteResult(ControllerContext context)
{
context.HttpContext.Response.ContentType = "application/rss+xml";
var rssFormatter = new Rss20FeedFormatter(Feed, false);
using (var writer = XmlWriter.Create(context.HttpContext.Response.Output, new XmlWriterSettings{ Indent = true}))
rssFormatter.WriteTo(writer);
}
}
フィードの作成方法の例。
new SyndicationFeed("Title", "Description", url, "test_id", publishDate, feedItems){ LastUpdatedTime = publishDate}
おかげで、これは私が探していたまさにです。 –