How to generate an RSS feed for your web site using ASP.NET

How to generate an RSS feed for your web site using ASP.NET

 

RSS stands for "Really Simple Syndication", is a standardized, XML-formatted means for syndication Web site content.

Understand that RSS is intended to provide information about a Web site's latest content. For example, Yahoo! News provides RSS feeds of the latest news headlines, and TigerDirect.com provides RSS feeds of the feature items on the shopping site. Notice that RSS provides a synopsis for the recent articles or news items. It does not provide the complete content for all of the news items or articles.

 

Let’s look at a demo RSS feed XML file: (Excerpted from the reference URL.)

<?xml version="1.0" encoding="utf-8"?>

<rss version="2.0">

       <channel>

              <title>uberASP.Net NewsWire</title>

              <link>http://www.uberasp.net/newswire.aspx</link>

              <description>The latest headlines and articles from the world of ASP.NET, Microsoft's Web development platform.</description>

              <copyright>(c) 2004, POP World Media, LLC. All rights reserved.</copyright>

              <ttl>5</ttl>

              <item>

                     <title>Using HttpModules to send the right data format to the client</title>

                     <description>The same data might need to be presented in many different formats, including HTML, XML, rich text, or even

                     an Excel file. Through the use of HttpModules, your site will serve the right kind of data every time.</description>

                     <link>http://www.uberasp.net/GetArticle.aspx?id=15</link>

                     <pubDate>Mon, 12 Jan 2004 04:48:34 GMT</pubDate>

              </item>

              <item>

                     <title>Going solo and running your own consulting business: Is it for you?</title>

                     <description>Columnist explores the ups and downs of being your own boss.</description>

                     <link>http://www.uberasp.net/GetArticle.aspx?id=14</link>

                     <pubDate>Mon, 12 Jan 2004 03:48:35 GMT</pubDate>

              </item>

              <item>

                     <title>Use an HttpHandler to stop bandwidth leeching of your images</title>

                     <description>HttpHandlers make it easy to handle certain file types with a simple interface that anyone can write

                     code for.</description>

                     <link>http://www.uberasp.net/GetArticle.aspx?id=13</link>

                     <pubDate>Fri, 09 Jan 2004 06:14:21 GMT</pubDate>

              </item>

       </channel>

</rss>

 

Brief introduction to RSS 2.0 speficiation:

The root element of an RSS document is <rss>. It has precisely one child element, <channel>. The <channel> element contains information about the syndicated content, as well as information about each content item being syndicated. There are three required channel elements:

l         <title> - provides a title for the channel.

l         <link> - a URL to the channel.

l         <description> - a short description of the channel.

There are additional optional elements, such as <language>, <copyright>, <webMaster>, and others. For a complete list refer to the RSS 2.0 specification.

 

The next important part of the spec is what you put in each item. The only thing required here is the title or description. We're using both, plus a link back to the article (because we want people to read the entire story, duh), and the pubDate element so the end-user can see how new the headline is.

[The above content is excerpted from the reference URL.]

 

******

The following two articles show you how to create an RSS syndication feed that adheres to the RSS 2.0 specification step by step.

Reference URL:

1. Building an RSS feed made simple, posted by Jeff

http://www.uberasp.net/getarticle.aspx?id=17

 

2. Syndicating Your Web Site's Content with RSS and ASP.NET, posted by Scott Mitchell

http://aspnet.4guysfromrolla.com/articles/021804-1.aspx

 

 

 

posted @ 2006-12-24 16:42  Rickie  阅读(944)  评论(2编辑  收藏  举报