四虎精品视频-四虎精品成人免费网站-四虎黄色网-四虎国产视频-国产免费91-国产蜜臀97一区二区三区

建立自己的RSS

本文主要提供代碼,創(chuàng)建自己的RSS,供別人訂閱...

--- 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>
 ///  取得聚合文章
 /// </summary>
 public class RSS : System.Web.UI.Page
 {
  Components.GenRSS gr = new Components.GenRSS(); // 實(shí)例化對(duì)象

  string strRSS = "";

  private void Page_Load(object sender, System.EventArgs e)
  {
   Response.ContentType = "application/xml"; // 輸出并按xml數(shù)據(jù)顯示
   Response.Write (GetRSS());
  }

  /// <summary>
  /// 取得聚合文章
  /// </summary>
  public string GetRSS()
  {  
   DataSet ds = gr.GenerateRSS(); // 調(diào)用GenerateRSS()方法,獲得數(shù)據(jù)

   strRSS = strRSS + "<rss version=/"2.0/">";
   strRSS = strRSS + "<channel>";
   strRSS = strRSS + "<title>土人制造</title>";
   strRSS = strRSS + "<link>http://www.socent.com</link>";
   strRSS = strRSS + "<description>土人制造</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>土人制造</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;
  }

  #region Web 窗體設(shè)計(jì)器生成的代碼
  override protected void OnInit(EventArgs e)
  {
   //
   // CODEGEN: 該調(diào)用是 ASP.NET Web 窗體設(shè)計(jì)器所必需的。
   //
   InitializeComponent();
   base.OnInit(e);
  }

  /// <summary>
  /// 設(shè)計(jì)器支持所需的方法 - 不要使用代碼編輯器修改
  /// 此方法的內(nèi)容。
  /// </summary>
  private void InitializeComponent()
  {   
   this.Load += new System.EventHandler(this.Page_Load);
  }
  #endregion
 }
}

AspNet技術(shù)建立自己的RSS,轉(zhuǎn)載需保留來(lái)源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 《西湖的绿》宗璞| 石灰吟教学设计一等奖优质课| 欧美变态挠痒痒视频∨k| 妙探出差3| 无声无息电影| 爱情买卖网站 电影| 台湾卫视| 爱秀直播| 淡蓝色的雨简谱| 我的父老乡亲| 看黄免费在线| 母猫叫声播放mp3| 卢靖姗老公是谁| 尹雪喜最好看的三部电影| 破晓东方演员表名单| 不可饶恕 电影| 蛇花| 次强音| 男男大尺度无删减床戏| 啪啪电影网| 我记得你| 无耻之徒英文| 拨罗卜视频免费观看| 惊悚电影| 大佬和我的365天| 职业探索怎么写| 安浦清子| 美女网站视频在线| 豪勇七蛟龙电影在线观看免费完整版| 女王眼泪| 《ulises》完整版在线观看| 老外毛片| 佐拉| 生活片爱情电影大全| 抗日片100部免费连续剧| 同字异音联| 贝利亚抱住奥特之母完整版| 我是老师电影完整版| 尹雪喜最惊艳的十部电视剧| 爱 死亡和机器人| 国内自拍99|