惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

GbyAI
GbyAI
V
Visual Studio Blog
美团技术团队
L
LINUX DO - 最新话题
Last Week in AI
Last Week in AI
雷峰网
雷峰网
博客园_首页
腾讯CDC
博客园 - Franky
大猫的无限游戏
大猫的无限游戏
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
人人都是产品经理
人人都是产品经理
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
J
Java Code Geeks
W
WeLiveSecurity
Apple Machine Learning Research
Apple Machine Learning Research
Spread Privacy
Spread Privacy
博客园 - 聂微东
量子位
Recent Announcements
Recent Announcements
S
Schneier on Security
O
OpenAI News
PCI Perspectives
PCI Perspectives
H
Heimdal Security Blog
T
Tailwind CSS Blog
S
Security Affairs
Y
Y Combinator Blog
P
Privacy International News Feed
Hacker News: Ask HN
Hacker News: Ask HN
Stack Overflow Blog
Stack Overflow Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
U
Unit 42
Webroot Blog
Webroot Blog
Vercel News
Vercel News
Simon Willison's Weblog
Simon Willison's Weblog
B
Blog RSS Feed
S
Secure Thoughts
Microsoft Azure Blog
Microsoft Azure Blog
N
Netflix TechBlog - Medium
V
V2EX
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
D
DataBreaches.Net
月光博客
月光博客
博客园 - 三生石上(FineUI控件)
L
LangChain Blog
S
Security @ Cisco Blogs
The Hacker News
The Hacker News
The GitHub Blog
The GitHub Blog
C
CERT Recently Published Vulnerability Notes

博客园 - 嘻哈呵嘿

编程实现QQ表情文件CFC格式 使用反射为指定的文件类型创建关联 一个小小的实用控件。 C#版的端口扫描器(PortScanner) 为FireFox的XMLDocument 增加 LoadXML,SelectNodes,SelectSingleNode方法。 - 嘻哈呵嘿 AJAX实现的购物车,使用Cookie保存。 - 嘻哈呵嘿 - 博客园 AJAX查询域名。:) - 嘻哈呵嘿 - 博客园 FreeTextBox的Toolbars? ZeroForums论坛正式开始测试运行 看看你的PageRank? 不知不觉在网上就拥有了两G的邮局..... 在WinForm中使用Web Services 来实现 软件 自动升级( Auto Update ) (C#) 根据指定Value选定winForm中的ComboBox中的Item 影视频道完工中。 Windows 的 calc 的弱智bug~~~~ 原来老外也喜欢盗版和盗连。呵呵。 Flash的中文输入以有及乱码问题。(已解决) 使用自定义的WebControl来构建简单的WebForm 用xhtml和css构建快速的Web页。
在asp.net中使用异步同步rss
嘻哈呵嘿 · 2006-09-24 · via 博客园 - 嘻哈呵嘿

有的时候我们需要在网页里读取论坛的信息,在传统ASP的时候我们使用的是JS或者是IFRAME,这两种方式都不是很方便,而且对搜索引擎不友好。现在有了.Net,我们有了另一种方式。

要求:论坛需要提供RSS支持。

代码如下:

  1    task class
 82
 83    //一个自定义的控件,继承自另一个自定义控件。
 84    public class RArticle
 85        : LPanel
 86    {
 87        properties
104
105        RssAsyncTask task;
106        protected override void OnInit(EventArgs e)
107        {
108            base.OnInit(e);
109            task = new RssAsyncTask(this.rssUrl);
110            PageAsyncTask asyncTask = new PageAsyncTask(task.OnBegin, task.OnEnd, task.OnTimeout, null);
111
112            Page.RegisterAsyncTask(asyncTask);
113            Page.ExecuteRegisteredAsyncTasks();
114        }

115
116        static Random r = new Random();
117        protected override void Render(System.Web.UI.HtmlTextWriter writer)
118        {
119            string rssContent = task.GetRssContent();
120            XmlDocument doc = null;
121            if (task.IsSuccess)
122            {
123                doc = new XmlDocument();
124                doc.LoadXml(rssContent);
125
126                this.Title = doc.SelectSingleNode("rss/channel/title").InnerText;
127                this.TitleNavigateUrl = doc.SelectSingleNode("rss/channel/link").InnerText;
128                this.ShowTitle = true;
129            }

130            base.RenderBegin(writer);
131
132            writer.WriteBeginTag("div");
133            writer.WriteAttribute("class""child2");
134            Right(writer);
135            writer.WriteBeginTag("ul");
136            Right(writer);
137
138            if (doc != null)
139            {
140                success
171            }

172            else
173            {
174                writer.WriteBeginTag("pre");
175                Right(writer);
176                writer.Write(task.GetRssContent());
177                writer.WriteEndTag("pre");
178            }

179
180            writer.WriteEndTag("ul");
181            writer.WriteEndTag("div");
182
183            RenderChildren(writer);
184
185            base.RenderEnd(writer);
186        }

187    }

188

使用方法:
一、注册控件

CODE:

<%@ Register Assembly="Controls" Namespace="Limited.Controls" TagPrefix="lm" %>

二、调用

CODE:

<lm:RArticle ID="RArticle1" runat="server" MaxRecordNumber="10" RssUrl="http://bbs.5inet.net/rss.aspx" />

为了简便起见,本程序就没有使用缓存之类的技术了,如有必要,请自行添加。

原文首发:http://bbs.5inet.net/topic.aspx?topicid=181

具体效果请见本站首页: http://www.5inet.net/

本文首发

无垠论坛,请大家多指教。