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

推荐订阅源

GbyAI
GbyAI
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
D
Docker
Blog — PlanetScale
Blog — PlanetScale
罗磊的独立博客
美团技术团队
V
V2EX
Last Week in AI
Last Week in AI
D
DataBreaches.Net
T
The Blog of Author Tim Ferriss
宝玉的分享
宝玉的分享
Microsoft Security Blog
Microsoft Security Blog
Microsoft Azure Blog
Microsoft Azure Blog
人人都是产品经理
人人都是产品经理
M
MIT News - Artificial intelligence
P
Proofpoint News Feed
B
Blog RSS Feed
博客园_首页
B
Blog
博客园 - 叶小钗
I
InfoQ
WordPress大学
WordPress大学
L
LangChain Blog
Apple Machine Learning Research
Apple Machine Learning Research
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
A
About on SuperTechFans
The GitHub Blog
The GitHub Blog
The Register - Security
The Register - Security
MyScale Blog
MyScale Blog
云风的 BLOG
云风的 BLOG
博客园 - 司徒正美
Latest news
Latest news
W
WeLiveSecurity
T
The Exploit Database - CXSecurity.com
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
aimingoo的专栏
aimingoo的专栏
小众软件
小众软件
Cyberwarzone
Cyberwarzone
Scott Helme
Scott Helme
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
CERT Recently Published Vulnerability Notes
C
CXSECURITY Database RSS Feed - CXSecurity.com
Recent Commits to openclaw:main
Recent Commits to openclaw:main
N
News and Events Feed by Topic
S
Secure Thoughts
The Hacker News
The Hacker News
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Google DeepMind News
Google DeepMind News

博客园 - fisherman

学习写第一个SQL server触发器 操纵自如--页面内的配合与通信 一些DIV+CSS 命名规范 避免重复提交 - fisherman - 博客园 button 删除确认 - fisherman - 博客园 用相对定位和负向移动完成图片象框阴影 负边距居中法(水平居中、垂直居中) - fisherman - 博客园 CSS 代码格式化工具 - fisherman - 博客园 JS代码的格式化和压缩 - fisherman - 博客园 把SQL SERVER里表里的数据导出成为insert into 脚本 对FckEditor编辑器在MAXTHON浏览器下选择服务器文件对话框显示不正常的改进 下载网页中远程图片的方法 读取marc数据 关于ISO2709数据的格式说明 C#写的读取ISO2709格式数据的DLL 数据库打开 使用 Engine 对象创建 SQL Server Compact Edition 数据库 用SharpZipLib压缩和解压缩文件 Access数据库压缩和修复
asp.net 2.0中生成RSS
fisherman · 2007-09-03 · via 博客园 - fisherman

asp.net 2.0中生成RSS
前台代码:
<%@ Page Language=”C#” AutoEventWireup=”true” ContentType=”text/xml” CodeFile=”MainFeed.aspx.cs” Inherits=”test2″ ValidateRequest=”false”  StylesheetTheme=”"  Theme=”"   EnableViewState=”false” ResponseEncoding=”UTF-8″%>
        <asp:Repeater ID=”RptRSS” runat=”server”>
        <HeaderTemplate>      
<rss version=”2.0″>
<channel>
<title>纪检监督</title>
<link>http://localhost/</link>
<description>
纪检监督信息网新闻排行
</description>

        </HeaderTemplate>
        <ItemTemplate>
        <item>
        <title><%#FormatForXML(Eval(”Title”)) %></title>
<link><%#Eval(”NewsUrl”) %></link>
<pubDate><%#Convert.ToDateTime(Eval(”ApprovedDate”).ToString()).ToString(”r”) %></pubDate>
<description><%#FormatForXML(Eval(”Abstract”))%></description>
<author><%#FormatForXML(Eval(”PostUser”))%></author>
</item>
        </ItemTemplate>
        <FooterTemplate>
        </channel>
       </rss>
        </FooterTemplate>
        </asp:Repeater>

后台代码:

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class test2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        DataView myDV = Inspection.WebModules.NewsManager.Business.News.GetTopNewsList().Tables[0].DefaultView;//根据自己的要求设置
        RptRSS.DataSource = myDV;
        RptRSS.DataBind();
    }
    protected string FormatForXML(object input)
    {
        string data = input.ToString();      // cast the input to a string

        // replace those characters disallowed in XML documents
        data = data.Replace(”&”, “&amp;”);
        data = data.Replace(”\”", “&quot;”);
        data = data.Replace(”‘”, “&apos;”);
        data = data.Replace(”>”, “&gt;”);

        return data;
    }

}


来源:http://steptry.wordpress.com/2005/12/20/aspnet-20%E4%B8%AD%E7%94%9F%E6%88%90rss/