2
내 ASP.net MVC 사이트에서 RSS 피드를 제공하려고합니다. 모든 pubdate 요소에 대한 수락을 작동합니다. Rss20FeedFormatter를 출력 할 수없는 것 같습니다. 나는 SyndicationFeed 객체의 LastUpdatedDate 속성에 매핑되지만 LastBuildDate로 출력한다고 생각했습니다.RSS SyndicationFeed api를 사용하여 pubDate 렌더링
내 RssFeed에 pubDate 노드를 렌더링하기 위해 Rss20FeedFormatter에서 SyndicationFeed를 어떻게 사용할 수 있는지 알고있는 사람이 있습니까?
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}
덕분에,이 내가 찾던 정확히 무엇 :
그냥 제대로 날짜를 포맷하는데주의를 기울여야 할 필요가, 여기 봐. –