国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

使用C#生成RSS

2024-07-21 02:26:31
字體:
來源:轉載
供稿:網友

商業源碼熱門下載www.html.org.cn

<%@ 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(); // 實例化對象

  string strrss = "";

  private void page_load(object sender, system.eventargs e)
  {
   response.contenttype = "application/xml"; // 輸出并按xml數據顯示
   response.write (getrss());
  }

  /// <summary>
  /// 取得聚合文章
  /// </summary>
  public string getrss()
  {  
   dataset ds = gr.generaterss(); // 調用generaterss()方法,獲得數據

   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/[email protected]"+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/[email protected]"+ds.tables[0].rows[i]["id"]+".html</comments>";
    strrss = strrss + "</item>";
   }
   strrss = strrss + "</channel>";
   strrss = strrss + "</rss>";
  
   return strrss;
  }

  #region web 窗體設計器生成的代碼
  override protected void oninit(eventargs e)
  {
   //
   // codegen: 該調用是 asp.net web 窗體設計器所必需的。
   //
   initializecomponent();
   base.oninit(e);
  }
 
  /// <summary>
  /// 設計器支持所需的方法 - 不要使用代碼編輯器修改
  /// 此方法的內容。
  /// </summary>
  private void initializecomponent()
  {   
   this.load += new system.eventhandler(this.page_load);
  }
  #endregion
 }
}

 


 

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 湖口县| 扎赉特旗| 北京市| 库伦旗| 乾安县| 乌恰县| 崇礼县| 鲁山县| 黄浦区| 北安市| 芜湖市| 瑞金市| 互助| 本溪| 皋兰县| 紫金县| 达拉特旗| 淳化县| 洛阳市| 九台市| 旬邑县| 灯塔市| 资溪县| 禹州市| 兴国县| 新乡县| 亳州市| 将乐县| 界首市| 广水市| 叙永县| 长顺县| 都匀市| 永新县| 邯郸市| 津市市| 安龙县| 高雄县| 凤城市| 迁安市| 丹凤县|