RSS generation code

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;< br>using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data .OleDb;
using System.Xml;

namespace wipe
{
///

/// The summary description of rssnews.
///

public class rssnews: System.Web.UI.Page
{
public string strRSS = “”;

private void Page_Load(object sender, System.EventArgs e)
{
Response.ContentType=”application/xml”;
Response.Write(GetRSS());

}

#Region Web form designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is made by the ASP.NET Web form designer Required.
//
InitializeComponent();
base.OnInit(e);
}

///

/// Required for designer support Method-Do not use a code editor to modify
/// the content of this method.
///

private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);

}
#Endregion

public string GetRSS()
{
DB s = new DB();
string sql = “select * from news”;
DataSet ds = s .CreateDataSet(sql,”news”);
strRSS = “ “;
strRSS = “” ;
strRSS = strRSS + ““;
strRSS = strRSS + “news“;
strRSS = strRSS + “http://www.socent .com“;
strRSS = strRSS + “news“;
for(int i = 0; i {
strRSS = strRSS + ““;
strRSS = strRSS + “<![CDATA["+ds.Tables[0].Rows[i]["Title "]+"]]>“;
strRSS = strRSS + “http://www.socent.com/ArticleShow@”+ds.Tables[0].Rows[i][ “id”]+”.html “;
strRSS = strRSS + ““;
strRSS = strRSS + “news“;
strRSS = strRSS + ““+Convert.ToDateTime(ds.Tables[ 0].Rows[i][“Add_time”].ToString()).ToString(“yyyy-MM-dd HH:mm”)+”“;
strRSS = strRSS + “ http://www.socent.com/CommentShow@”+ds.Tables[0].Rows[i][“id”]+”.html“;
strRSS = strRSS + ““;
   }
   strRSS = strRSS + “
“;
   strRSS = strRSS + “
“;
 
   return strRSS;
  }< /p>

}}

Leave a Comment

Your email address will not be published.