我想做个BLOG,就是不知道怎么去做RSS阅读那部分,请高人指点 其他的都没问题,就是这个RSS阅读不知该从哪下手 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 rss.aspx<%@ Page language="c#" Codebehind="rss.aspx.cs" AutoEventWireup="false" Inherits="Blog.rss" %>rss.aspx.csprivate void Page_Load(object sender, System.EventArgs e) { String code; conn=connc.blog_conn(); String sql="select * from table order by id desc"; OleDbDataAdapter myCommand = new OleDbDataAdapter(); myCommand.SelectCommand=new OleDbCommand(sql,conn); DataSet mylist = new DataSet(); myCommand.Fill(mylist,"rss"); Response.ContentType = "application/xml"; code="<?xml version='1.0' ?>\n"; code+="<rss version='2.0'>\n"; code+="<channel>\n"; code+="<title>RSS2.0</title> \n"; code+="<link>http://"+Request.ServerVariables["SERVER_NAME"]+"</link> \n"; code+="<copyright>Copyright 2004</copyright> \n"; for (int i=0;i<mylist.Tables[0].Rows.Count;i++) { code+="<item>\n"; code+="<title><![CDATA["+mylist.Tables[0].Rows[i]["title"]+"]]></title>\n"; code+="<link>http://"+Request.ServerVariables["SERVER_NAME"]+"/detail.aspx"+"?id="+mylist.Tables[0].Rows[i]["id"]+"</link>\n"; code+="<description><![CDATA["+mylist.Tables[0].Rows[i]["content"]+"]]></description>\n"; code+="<addperson>"+mylist.Tables[0].Rows[i]["person"]+"</addperson>\n"; code+="<PubDate>"+mylist.Tables[0].Rows[i]["addtime"]+"</PubDate>\n"; code+="<category>"+int.Parse(mylist.Tables[0].Rows[i]["classid"].ToString())+"</category>\n"; code+="</item>\n"; } code+="</channel>\n"; code+="</rss>\n"; Response.ContentType="text/xml"; Response.Write(code); } Response.ContentType = "application/xml"; code="<?xml version='1.0' ?>\n"; code+="<rss version='2.0'>\n"; code+="<channel>\n"; code+="<title>RSS2.0</title> \n"; code+="<link>http://"+Request.ServerVariables["SERVER_NAME"]+"</link> \n"; code+="<copyright>Copyright 2004</copyright> \n"; rss就是一些特定的标记的XML文件,以上先把输出类型改为XML,然后写XML声明,RSS声明,跟节点,<LINK〉标记等,然后for循环中就是一些项,最后关闭标签你可以去百度搜索rss的介绍,,然后就会明白,其实很简单的。当然这里是动态现实你可以直接生成xml http://community.csdn.net/Expert/topic/4412/4412960.xml?temp=.6080286 关于大文件上传(多文件),下载 ,断点续传 请高手支招 mvc Text模板引擎和XML模板引擎的使用配置方法? 日期的比较 高分在线急问:我在代码中用JScript打开一个新的窗口,结果在XP下被系统当广告拦截了,请问高手如何解决 客户端存储数据问题 求助!asp.net(VB)怎么使用MD5加密和解密???? 才鸟要做库存系统 请高人给些设计思路啊!!!! datagrid得美化 问英文字段名转换为中文标题显示的sql语句 jquery+ajax 如何调用页面后台方法? RSS是什么东西,现在网站上都加个RSS订阅有什么作用啊? 高手请看 Rss问题
<%@ Page language="c#" Codebehind="rss.aspx.cs" AutoEventWireup="false" Inherits="Blog.rss" %>
rss.aspx.csprivate void Page_Load(object sender, System.EventArgs e)
{
String code;
conn=connc.blog_conn();
String sql="select * from table order by id desc";
OleDbDataAdapter myCommand = new OleDbDataAdapter();
myCommand.SelectCommand=new OleDbCommand(sql,conn);
DataSet mylist = new DataSet();
myCommand.Fill(mylist,"rss");
Response.ContentType = "application/xml";
code="<?xml version='1.0' ?>\n";
code+="<rss version='2.0'>\n";
code+="<channel>\n";
code+="<title>RSS2.0</title> \n";
code+="<link>http://"+Request.ServerVariables["SERVER_NAME"]+"</link> \n";
code+="<copyright>Copyright 2004</copyright> \n";
for (int i=0;i<mylist.Tables[0].Rows.Count;i++)
{
code+="<item>\n";
code+="<title><![CDATA["+mylist.Tables[0].Rows[i]["title"]+"]]></title>\n";
code+="<link>http://"+Request.ServerVariables["SERVER_NAME"]+"/detail.aspx"+"?id="+mylist.Tables[0].Rows[i]["id"]+"</link>\n";
code+="<description><![CDATA["+mylist.Tables[0].Rows[i]["content"]+"]]></description>\n";
code+="<addperson>"+mylist.Tables[0].Rows[i]["person"]+"</addperson>\n";
code+="<PubDate>"+mylist.Tables[0].Rows[i]["addtime"]+"</PubDate>\n";
code+="<category>"+int.Parse(mylist.Tables[0].Rows[i]["classid"].ToString())+"</category>\n";
code+="</item>\n";
}
code+="</channel>\n";
code+="</rss>\n";
Response.ContentType="text/xml";
Response.Write(code);
}
code="<?xml version='1.0' ?>\n";
code+="<rss version='2.0'>\n";
code+="<channel>\n";
code+="<title>RSS2.0</title> \n";
code+="<link>http://"+Request.ServerVariables["SERVER_NAME"]+"</link> \n";
code+="<copyright>Copyright 2004</copyright> \n";
rss就是一些特定的标记的XML文件,以上先把输出类型改为XML,然后写XML声明,RSS声明,跟节点,<LINK〉标记等,然后for循环中就是一些项,最后关闭标签
你可以去百度搜索rss的介绍,,然后就会明白,其实很简单的。当然这里是动态现实
你可以直接生成xml