急求RSS实例一个,C#写的因为我没有做过.而且现在急得要学.
要求是写入数据库后读出来.象一般网站上的RSS功能一样.
希望有大鸟能帮一下我.谢谢大家指教.
要求是写入数据库后读出来.象一般网站上的RSS功能一样.
希望有大鸟能帮一下我.谢谢大家指教.
解决方案 »
- 高分求助,点击按钮弹出确认框的问题
- 水晶报表的自定义函数问题!!!!急!!!100分送!!!!!!!!!
- datagrid出现极大错误
- 请教一个移动变色的问题!
- ASP.NET中怎么调用Delphi开发的进程外COM呢?
- DropDownList用了.Attributes.Add("onchange后不能响应SelectedIndexChanged
- 怎么上传SQL数据文件到服务器数据库
- 有关在DetailsView1_ItemUpdating中设置ObjectDataSource1.UpdateParameters的问题
- oledb不支持连接字符串
- 严重问题,新记录加不了!!!!!!快帮我啊~!!!!!!!!!!!!!!!!!
- 请高手指教,我这样的数据绑定的思路,是否合理?如何实现?
- 关于事件响应的问题,各位有什么好的办法
那位有也顺便给我一份[email protected]
晚一点可以发一个示例,有需要的到http://www.dtable.com/DTableBBS/show.aspx?keyword=&addnew=true&rMviewid=5045这个页面留下Email
http://www.codersource.net/asp_net_rss_feeds.aspx
http://rollerweblogger.org/page/roller?entry=parsing_rss_with_net
http://blogs.msdn.com/dmitryr/archive/2006/03/26/561200.aspxScott Guthrie的示范
http://weblogs.asp.net/scottgu/archive/2006/02/22/438738.aspx
winner.Append("<?xml version='1.0' encoding='GB2312'?>\n");
winner.Append("<rss version='2.0'>\n");
winner.Append("<channel>\n");
winner.Append("<title>拓文网络</title>\n");
winner.Append("<description>栏目名字</description>\n");
winner.Append("<language>zh-cn</language>\n");
winner.Append("<generator>www.myTopWin.com</generator>\n");
winner.Append("<link>http://"+Request.ServerVariables["SERVER_NAME"]+"</link> \n");
winner.Append("<copyright>Copyright 2005-2006 www.myTopWin.com, All Rights Reserved</copyright> \n");
winner.Append("<pubDate>2006-4-1 11:29:09</pubDate>"); for ( int i=0;i < Mydataset.Tables[0].Rows.Count; i++ )
{
winner.Append("<item>\n");
winner.Append("<title><![CDATA["+Format(Mydataset.Tables[0].Rows[i]["title"])+"]]></title>\n");
winner.Append("<link>http://"+Request.ServerVariables["SERVER_NAME"]+"/Article/ShowArticle/"+Mydataset.Tables[0].Rows[i]["ClassID"]+"/"+Mydataset.Tables[0].Rows[i]["id"]+"_1.html</link>\n");
winner.Append("<author />\n");
winner.Append("<description><![CDATA["+Format(MyLeftFunction(Mydataset.Tables[0].Rows[i]["content"]))+"]]></description>\n");
winner.Append("<guid />\n");
winner.Append("<category />\n");
winner.Append("</item>\n");
} winner.Append("</channel>\n");
winner.Append("</rss>\n"); Response.ContentType="text/xml";
Response.Write(winner.ToString());
}
http://www.rssdotnet.com/
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>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;
using ly.webdata.userlib;
using ly.webdata;
using DataLayer;namespace ly.WebProg
{
public partial class Rss : System.Web.UI.Page
{
bloglib user1 = new bloglib();
string strRSS = "";
protected void Page_Load(object sender, EventArgs e)
{
Response.Clear();
Response.ContentType = "application/xml"; // 输出并按xml数据显示
Response.Write(getdata());
Response.End();
} protected string getdata()
{
//数据获取部分
DataSet ds = user1.GetTravelNoteInfo("jam"); //取游记 用户名可以从URL中获取
DataSet photods = user1.GetPhotoInfo("jam"); //取图片 int num = ds.Tables[0].Rows.Count;
int photonum = photods.Tables[0].Rows.Count; //数据取示部分,可参见RSS 2.0的规范 //RSS的提要
strRSS = strRSS + "<rss version=\"2.0\">";
strRSS = strRSS + "<channel>";
strRSS = strRSS + "<title>中华游</title>";
strRSS = strRSS + "<Description>这里是描述</Description>";
strRSS = strRSS + "<lastBuildDate>" + System.DateTime.Now + "</lastBuildDate>";
strRSS = strRSS + "<cloud domain=\"202.193.64.67\" port=\"80\" path=\"/RPC2\" registerProcedure=\"pingMe\" protocol=\"soap\"></cloud>";
strRSS = strRSS + "<ttl>60</ttl>"; //游记部分
for (int i = 0; i < num; i++)
{
strRSS = strRSS + "<item>";
strRSS = strRSS + "<title><![CDATA[" + ds.Tables[0].Rows[i]["TNI_Title"] + "]]></title>";
strRSS = strRSS + "<link>这里是link的内容</link> ";
strRSS = strRSS + "<description><![CDATA[" + ds.Tables[0].Rows[i]["TNI_Content"] + "]]></description>";
strRSS = strRSS + "<pubDate>" + Convert.ToDateTime(ds.Tables[0].Rows[i]["TNI_RelTime"].ToString()).ToString("yyyy-MM-dd HH:mm") + "</pubDate>";
strRSS = strRSS + "</item>";
} //图片部分
for (int i = 0; i < photonum; i++)
{
strRSS = strRSS + "<image>";
strRSS = strRSS + "<url>" + photods.Tables[0].Rows[i]["PI_Path"] + "</url> ";
strRSS = strRSS + "<title>" + photods.Tables[0].Rows[i]["PI_Title"] + "</title>";
strRSS = strRSS + "</image>";
} strRSS = strRSS + "</channel>";
strRSS = strRSS + "</rss>";
return strRSS;
}
}
}
欢迎加入!