Jay Nathan's Weblog
Wednesday, June 02, 2004
 
Using RSS.NET within an ASP.NET page


Here's how simple RSS.NET is to use within an ASP.NET application. You can create a feed from virtually any data that exists within your enterprise. At this stage in the game, it is going to be more difficult to get users to begin using some type of aggregator/news reader than it is going to be to produce the news feeds! Thanks to George Tsiokos for putting this together.




RssChannel rssChannel = new RssChannel();
rssChannel.Title = "Jay's Web Log";
rssChannel.PubDate = DateTime.Now;
rssChannel.Link = "http://blogspot.jaynathan.com";
rssChannel.LastBuildDate = DateTime.Now;
rssChannel.Description = "Description of my channel...";

foreach(Item i in feedItems)
{
RssItem rssItem = new RssItem();
rssItem.Author = item.Author;
rssItem.Link = item.Link;
rssItem.PubDate = item.ModDate;
rssItem.Title = item.Name;
rssItem.Description = description;
rssChannel.Items.Add(rssItem);
}


RssFeed rssFeed = new RssFeed();
rssFeed.Channels.Add(rssChannel);
Response.ContentType = "text/xml";
Response.ExpiresAbsolute = DateTime.MinValue;
rssFeed.Write(Response.OutputStream);




Comments: Post a Comment

<< Home

Powered by Blogger