【发布时间】:2012-02-17 20:04:52
【问题描述】:
这种方法的可靠性如何?我目前正在使用它,它可以很好地提取我的提要,但如果我的博客由于某种原因关闭或离线,整个页面就会出错。有没有什么办法解决这一问题?或者只是给出一条错误消息,说“未找到供稿。”?
<asp:DataList ID="dataNews" runat="server" DataSourceID="xmlSource" >
<ItemTemplate>
<a href="<%# XPath("link") %>"><%# XPath("title") %></a><br />
<%# XPath("description").ToString().Substring(0,100) %>...
</ItemTemplate>
</asp:DataList>
<asp:XmlDataSource ID="xmlSource" runat="server" DataFile="http://blogurl.com/feed" XPath="rss/channel/item[position()<4]" EnableCaching="false" />
【问题讨论】:
-
试试看。
http://blogurl.local/feed不起作用。 -
那么当你运行它时会发生什么?