123456789101112131415161718192021222324252627282930313233343536 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.ServiceModel.Syndication;
- using System.Text;
- using System.Threading.Tasks;
- using System.Web;
- using System.Web.Mvc;
- using System.Xml;
-
- namespace Teknik.Helpers
- {
- public class RssResult : ActionResult
- {
- public SyndicationFeed Feed { get; set; }
-
- public RssResult() { }
-
- public RssResult(SyndicationFeed feed)
- {
- this.Feed = feed;
- }
-
- public override void ExecuteResult(ControllerContext context)
- {
- context.HttpContext.Response.ContentType = "application/rss+xml";
-
- Rss20FeedFormatter formatter = new Rss20FeedFormatter(this.Feed);
-
- using (XmlWriter writer = XmlWriter.Create(context.HttpContext.Response.Output))
- {
- formatter.WriteTo(writer);
- }
- }
- }
- }
|