1
<%@ Page language="c#" Codebehind="RSS.aspx.cs" AutoEventWireup="false" Inherits="Socent.RSS" %>
2
3
--- RSS.aspx.cs
4
5
using System;
6
using System.Collections;
7
using System.ComponentModel;
8
using System.Data;
9
using System.Drawing;
10
using System.Web;
11
using System.Web.SessionState;
12
using System.Web.UI;
13
using System.Web.UI.WebControls;
14
using System.Web.UI.HtmlControls;
15
16
namespace Socent
17
...{
18
/**//// <summary>
19
/// 取得聚合文章
20
/// </summary>
21
public class RSS : System.Web.UI.Page
22
...{
23
Components.GenRSS gr = new Components.GenRSS(); // 实例化对象
24
25
string strRSS = "";
26
27
private void Page_Load(object sender, System.EventArgs e)
28
...{
29
Response.ContentType = "application/xml"; // 输出并按xml数据显示
30
Response.Write (GetRSS());
31
}
32
33
/**//// <summary>
34
/// 取得聚合文章
35
/// </summary>
36
public string GetRSS()
37
...{
38
DataSet ds = gr.GenerateRSS(); // 调用GenerateRSS()方法,获得数据
39
40
strRSS = strRSS + "<rss version=/"2.0/">";
41
strRSS = strRSS + "<channel>";
42
strRSS = strRSS + "<title>土人制造</title>";
43
strRSS = strRSS + "<link>http://www.socent.com</link>";
44
strRSS = strRSS + "<description>土人制造</description>";
45
for(int i = 0; i < ds.Tables[0].Rows.Count; i++)
46
...{
47
strRSS = strRSS + "<item>";
48
strRSS = strRSS + "<title><![CDATA["+ds.Tables[0].Rows[i]["Title"]+"]]></title>";
49
strRSS = strRSS + "<link>http://www.socent.com/ArticleShow@"+ds.Tables[0].Rows[i]["ID"]+".html</link> ";
50
strRSS = strRSS + "<description><![CDATA["+ds.Tables[0].Rows[i]["Description"]+"]]></description>";
51
strRSS = strRSS + "<copyright>土人制造</copyright>";
52
strRSS = strRSS + "<pubDate>"+Convert.ToDateTime(ds.Tables[0].Rows[i]["AddDate"].ToString()).ToString("yyyy-MM-dd HH:mm")+"</pubDate>";
53
strRSS = strRSS + "<comments>http://www.socent.com/CommentShow@"+ds.Tables[0].Rows[i]["ID"]+".html</comments>";
54
strRSS = strRSS + "</item>";
55
}
56
strRSS = strRSS + "</channel>";
57
strRSS = strRSS + "</rss>";
58
59
return strRSS;
60
}
61
62
Web 窗体设计器生成的代码#region Web 窗体设计器生成的代码
63
override protected void OnInit(EventArgs e)
64
...{
65
//
66
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
67
//
68
InitializeComponent();
69
base.OnInit(e);
70
}
71
72
/**//// <summary>
73
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
74
/// 此方法的内容。
75
/// </summary>
76
private void InitializeComponent()
77
...{
78
this.Load += new System.EventHandler(this.Page_Load);
79
}
80
#endregion
81
}
82
}
83
84
85
86
87
<%@ Page language="c#" Codebehind="RSS.aspx.cs" AutoEventWireup="false" Inherits="Socent.RSS" %>2

3
--- RSS.aspx.cs4

5
using System;6
using System.Collections;7
using System.ComponentModel;8
using System.Data;9
using System.Drawing;10
using System.Web;11
using System.Web.SessionState;12
using System.Web.UI;13
using System.Web.UI.WebControls;14
using System.Web.UI.HtmlControls;15

16
namespace Socent17

...{18

/**//// <summary>19
/// 取得聚合文章20
/// </summary>21
public class RSS : System.Web.UI.Page22

...{23
Components.GenRSS gr = new Components.GenRSS(); // 实例化对象24

25
string strRSS = "";26

27
private void Page_Load(object sender, System.EventArgs e)28

...{29
Response.ContentType = "application/xml"; // 输出并按xml数据显示30
Response.Write (GetRSS());31
}32

33

/**//// <summary>34
/// 取得聚合文章35
/// </summary>36
public string GetRSS()37

...{ 38
DataSet ds = gr.GenerateRSS(); // 调用GenerateRSS()方法,获得数据39

40
strRSS = strRSS + "<rss version=/"2.0/">";41
strRSS = strRSS + "<channel>";42
strRSS = strRSS + "<title>土人制造</title>";43
strRSS = strRSS + "<link>http://www.socent.com</link>";44
strRSS = strRSS + "<description>土人制造</description>";45
for(int i = 0; i < ds.Tables[0].Rows.Count; i++)46

...{47
strRSS = strRSS + "<item>";48
strRSS = strRSS + "<title><![CDATA["+ds.Tables[0].Rows[i]["Title"]+"]]></title>";49
strRSS = strRSS + "<link>http://www.socent.com/ArticleShow@"+ds.Tables[0].Rows[i]["ID"]+".html</link> ";50
strRSS = strRSS + "<description><![CDATA["+ds.Tables[0].Rows[i]["Description"]+"]]></description>";51
strRSS = strRSS + "<copyright>土人制造</copyright>";52
strRSS = strRSS + "<pubDate>"+Convert.ToDateTime(ds.Tables[0].Rows[i]["AddDate"].ToString()).ToString("yyyy-MM-dd HH:mm")+"</pubDate>";53
strRSS = strRSS + "<comments>http://www.socent.com/CommentShow@"+ds.Tables[0].Rows[i]["ID"]+".html</comments>";54
strRSS = strRSS + "</item>";55
}56
strRSS = strRSS + "</channel>";57
strRSS = strRSS + "</rss>";58
59
return strRSS;60
}61

62

Web 窗体设计器生成的代码#region Web 窗体设计器生成的代码63
override protected void OnInit(EventArgs e)64

...{65
//66
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。67
//68
InitializeComponent();69
base.OnInit(e);70
}71
72

/**//// <summary>73
/// 设计器支持所需的方法 - 不要使用代码编辑器修改74
/// 此方法的内容。75
/// </summary>76
private void InitializeComponent()77

...{ 78
this.Load += new System.EventHandler(this.Page_Load);79
}80
#endregion81
}82
}83

84

85

86

87

958

被折叠的 条评论
为什么被折叠?



