其他的都没问题,就是这个RSS阅读不知该从哪下手

解决方案 »

  1.   

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

  2.   

    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
      

  3.   

    http://community.csdn.net/Expert/topic/4412/4412960.xml?temp=.6080286