using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.ServiceModel.Syndication;
using System.ServiceModel.Web;
using System.Xml;
using System.Collections.Generic;

public partial class CreateRss : System.Web.UI.Page
{
    
protected void Page_Load(object sender, EventArgs e)
    
{
            SyndicationFeed feed 
= new SyndicationFeed("Test Feed""This is a test feed"new Uri("http://Contoso/testfeed"), "TestFeedID", DateTime.Now);
            SyndicationItem item 
= new SyndicationItem("Test Item""This is the content for Test Item"new Uri("http://Contoso/ItemOne"), "TestItemID", DateTime.Now);

            List
<SyndicationItem> items = new List<SyndicationItem>();
            items.Add(item);
            feed.Items 
= items;

            XmlWriter rssWriter 
= XmlWriter.Create(Server.MapPath("RSS.XML"));
            Rss20FeedFormatter rssFormatter 
= new Rss20FeedFormatter(feed);
            rssFormatter.WriteTo(rssWriter);
            rssWriter.Close();
    }

}
         
posted on 2008-05-26 14:22  miao~  阅读(340)  评论(0编辑  收藏  举报