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

推荐订阅源

T
The Exploit Database - CXSecurity.com
A
Arctic Wolf
K
Kaspersky official blog
T
Threat Research - Cisco Blogs
PCI Perspectives
PCI Perspectives
www.infosecurity-magazine.com
www.infosecurity-magazine.com
P
Privacy International News Feed
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
U
Unit 42
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Simon Willison's Weblog
Simon Willison's Weblog
P
Privacy & Cybersecurity Law Blog
O
OpenAI News
量子位
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
C
Cisco Blogs
AWS News Blog
AWS News Blog
Vercel News
Vercel News
Microsoft Security Blog
Microsoft Security Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
美团技术团队
T
Threatpost
S
Schneier on Security
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
C
Cyber Attacks, Cyber Crime and Cyber Security
Last Week in AI
Last Week in AI
C
CERT Recently Published Vulnerability Notes
Blog — PlanetScale
Blog — PlanetScale
C
Cybersecurity and Infrastructure Security Agency CISA
F
Full Disclosure
博客园_首页
N
Netflix TechBlog - Medium
Security Latest
Security Latest
有赞技术团队
有赞技术团队
Google DeepMind News
Google DeepMind News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
The Register - Security
The Register - Security
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Recent Announcements
Recent Announcements
博客园 - Franky
P
Palo Alto Networks Blog
Project Zero
Project Zero
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
H
Help Net Security
Hacker News: Ask HN
Hacker News: Ask HN
Cisco Talos Blog
Cisco Talos Blog
H
Heimdal Security Blog
The Hacker News
The Hacker News
博客园 - 【当耐特】
GbyAI
GbyAI

博客园 - 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/