This article mainly provides code to create your own RSS for others' subscriptions...
--- RSS. aspx
<% @ Page language = "c #" Codebehind = "RSS. aspx. cs" AutoEventWireup = "false" Inherits = "Socent. RSS" %>
--- RSS. aspx. cs
Using System;
Using System. Collections;
Using System. ComponentModel;
Using System. Data;
Using System. Drawing;
Using System. Web;
Using System. Web. SessionState;
Using System. Web. UI;
Using System. Web. UI. WebControls;
Using System. Web. UI. HtmlControls;
Namespace Socent
{
/// <Summary>
/// Obtain the aggregated article
/// </Summary>
Public class RSS: System. Web. UI. Page
{
Components. GenRSS gr = new Components. GenRSS (); // instantiate an object
String strRSS = "";
Private void Page_Load (object sender, System. EventArgs e)
{
Response. ContentType = "application/xml"; // output and display according to xml data
Response. Write (GetRSS ());
}
/// <Summary>
/// Obtain the aggregated article
/// </Summary>
Public string GetRSS ()
{
DataSet ds = gr. GenerateRSS (); // call the GenerateRSS () method to obtain data
StrRSS = strRSS + "<rss version = \" 2.0 \ "> ";
StrRSS = strRSS + "<channel> ";
StrRSS = strRSS + "<title> civil manufacturing </title> ";
StrRSS = strRSS + "<link> http://www.socent.com </link> ";
StrRSS = strRSS + "<description> made by people </description> ";
For (int I = 0; I <ds. Tables [0]. Rows. Count; I ++)
{
StrRSS = strRSS + "<item> ";
StrRSS = strRSS + "<title> <! [CDATA ["+ ds. Tables [0]. Rows [I] [" Title "] +"]> </title> ";
StrRSS = strRSS + "<link> http://www.socent.com/ArticleShow@" + ds. Tables [0]. Rows [I] ["ID"] + ". html </link> ";
StrRSS = strRSS + "<description> <! [CDATA ["+ ds. Tables [0]. Rows [I] [" Description "] +"]> </description> ";
StrRSS = strRSS + "<copyright> made by people </copyright> ";
StrRSS = strRSS + "<pubDate>" + Convert. toDateTime (ds. tables [0]. rows [I] ["AddDate"]. toString ()). toString ("yyyy-MM-dd HH: mm") + "</pubDate> ";
StrRSS = strRSS + "<comments> http://www.socent.com/CommentShow@" + ds. Tables [0]. Rows [I] ["ID"] + ". html </comments> ";
StrRSS = strRSS + "</item> ";
}
StrRSS = strRSS + "</channel> ";
StrRSS = strRSS + "</rss> ";
Return strRSS;
}
# Code generated by region Web Form Designer
Override protected void OnInit (EventArgs e)
{
//
// CODEGEN: This call is required by the ASP. NET Web form designer.
//
InitializeComponent ();
Base. OnInit (e );
}
/// <Summary>
/// The designer supports the required methods-do not use the code editor to modify
/// Content of this method.
/// </Summary>
Private void InitializeComponent ()
{
This. Load + = new System. EventHandler (this. Page_Load );
}
# Endregion
}
}