1

How reliable is this method? I'm currently using it and it pulls in my feed fine, but if my blog were to go down or offline for some reason the whole page would error out. Is there any way to fix this? Or just give an error message saying "No feeds found."?

<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" />
phoog
  • 42,068
  • 6
  • 79
  • 117
Trey Copeland
  • 3,387
  • 7
  • 29
  • 46

1 Answers1

1

You answered your own question. If the feed cannot be loaded successfully, your code should detect it and exit gracefully, i.e. show an error message, show an alternate bit of content, etc.

Ryan
  • 26,884
  • 9
  • 56
  • 83
  • 1
    No, but take a look at this question for an example: http://stackoverflow.com/questions/2624251/handling-xmldatasource-when-remote-xml-source-not-available – Ryan Feb 17 '12 at 20:33