惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google DeepMind News
Google DeepMind News
D
DataBreaches.Net
C
Check Point Blog
I
InfoQ
A
About on SuperTechFans
Engineering at Meta
Engineering at Meta
月光博客
月光博客
Recent Announcements
Recent Announcements
酷 壳 – CoolShell
酷 壳 – CoolShell
T
Tailwind CSS Blog
Y
Y Combinator Blog
博客园 - Franky
博客园_首页
罗磊的独立博客
量子位
美团技术团队
T
The Blog of Author Tim Ferriss
Last Week in AI
Last Week in AI
大猫的无限游戏
大猫的无限游戏
爱范儿
爱范儿
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Martin Fowler
Martin Fowler
博客园 - 叶小钗
aimingoo的专栏
aimingoo的专栏

博客园 - miao~

C# 截取1位小数 ASP.NET 获取MSN联系人列表 扩展老赵的 直接通过User Control生成HTML 分页功能 小技巧在Repeater控件中找到对应模板内的控件 大型互联网网站架构心得之一:分 UML 序列图 sql存储过程教程 Create an ASP.NET AJAX Style Folder Explorer BS程序代码与安全与基本攻击/防御模式 RSS2.0规范 利用 .NET 3.5 的 Syndication 相关类读取 RSS Feeds 使用linq to xml 快速创建自己的Rss 代码设计简单规范 VS.PHP 在Visual Studio 下的 PHP 开发 IDE 工具 窥探jQuery——面向JavaScript程序员 开发一个适合Ajax+JSON+jQuery环境使用的多功能页码栏——jPagerBar-1.1.1 最实用的12条css技巧 不错的下拉列表.HTML控件和服务器控件都可以使用 两个粒度看Asp.net生命周期
利用 .NET 3.5 的 Syndication 相关类生成 RSS
miao~ · 2008-05-26 · via 博客园 - miao~

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();
    }

}