PC Review


Reply
Thread Tools Rate Thread

Consuming rss feed preventing error on server down

 
 
Bo
Guest
Posts: n/a
 
      1st Aug 2008
Hope somebody can help me.

I show some remote rss feeds on my page with this code. But if the remote
server is down how do prevent my page from getting an error? In short how do
I add some code so it gives up trying to load the remote rss feed if it's
not online?

In the code behind.....

Protected Sub Genres_SelectedIndexChanged(ByVal sender As Object, ByVal e As
EventArgs)
UpdateGenre()
End Sub

Private Sub UpdateGenre()
GenreSource.DataFile = Genres.SelectedValue
GenreNews.DataBind()
System.Threading.Thread.Sleep(2000)
End Sub
Protected Sub UpdateNews(ByVal sender As Object, ByVal e As EventArgs)
UpdateGenre()
'GenrePanel.Update();
End Sub


on the aspx page....

<asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
<Scripts>
<asp:ScriptReference Path="~/scripts/DummyScript.js" />
</Scripts>
</asp:ScriptManagerProxy><asp:UpdatePanel ID="GenrePanel" runat="server"
UpdateMode="Conditional">
<ContentTemplate>
<aspropDownList ID="Genres" runat="server"
AutoPostBack="True" OnSelectedIndexChanged="Genres_SelectedIndexChanged"
CssClass="mytext">
<asp:ListItem Text="Link"
Value="http://www.whatever.com/rss" Selected="true" />
</aspropDownList>
<asp:UpdateProgress ID="UpdatingNews" runat="server"
AssociatedUpdatePanelID="GenrePanel" >
<ProgressTemplate>
<img src="pics/indicator.gif" alt="" />&nbsp;Getting
....
</ProgressTemplate>
</asp:UpdateProgress>
<br /><br />
<asp:Repeater ID="GenreNews" runat="server"
DataSourceID="GenreSource" >
<ItemTemplate>
<div class="mytext">
<asp:HyperLink ID="HyperLink1" runat="server"
NavigateUrl='<%#XPath("link") %>' Text='<%#XPath("title") %>'
Target="_blank" Font-Bold="true" />
</div>
</ItemTemplate>
</asp:Repeater>
</ContentTemplate>
</asp:UpdatePanel>
<asp:XmlDataSource runat="server"
DataFile="http://www.whatever.com/rss" ID="GenreSource"
XPath="/rss/channel/item [position()<=5]">
</asp:XmlDataSource>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to retrieve CGI rss feed using asp.net but error The remote server returned an error: (503) Server Unavailable. rote Microsoft ASP .NET 0 6th Mar 2008 11:26 PM
Newbie Question - Pass a parameter when consuming XML feed Bishop Microsoft Dot NET Framework 1 30th Oct 2007 03:03 PM
Pass a parameter when consuming XML feed Newbie Question Bishop Microsoft ASP .NET 0 29th Oct 2007 09:18 PM
Error message preventing access to the server =?Utf-8?B?Si4gQ29iYg==?= Microsoft Frontpage 7 19th Nov 2006 07:42 AM
Preventing Windows 98 from appending a form feed at the end of a print job Subho Printers 1 27th May 2004 02:12 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:51 PM.