ASP.NET 2.0 ProfessionalIf you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 2.0 Professional section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
I have an ASP.NET page that parses an external XML feed (please see code below). It works...but when the feed goes down, it subsequently brings my site down. So I've created a default XML document that's located on my internal server a backup method when/if the external feed goes down. But I have no idea how to do this. If someone could let me know how to accomplish this, or point me in the right direction, that would be great. Thanks in advance.
ASP.NET XML FEED CODE
Code:
'Check for active amber alert
Dim strAlertTitle As String, strAlertDescription As String
Dim intAlertCounter As Integer = 0
Dim alert_xmld As XmlDocument
Dim alert_nodelist As XmlNodeList
Dim alert_node As XmlNode
'Create the XML Document
alert_xmld = New XmlDocument()
'Load the Xml file
alert_xmld.Load("http://codeamber.org/a1xl04act/amberalert.xml") 'LIVE
'alert_xmld.Load("http://www.mysite.com/docs/xml/alert.xml") 'DEFAULT XML DOC TO USE AT DOWNTIME
'Get the list of name nodes
alert_nodelist = alert_xmld.SelectNodes("/AmberAlerts/AmberAlert[Alertstatus/@status = 'open' and contains(Alertinfo/@states, 'CO')]")
'Loop active amber alerts
For Each alert_node In alert_nodelist
intAACounter = intAACounter + 1
If intAACounter >= 1 Then
strAlertTitle = "Amber Alert"
strAlertDescription = "There is currently an amber alert in Colorado."
Else If intAACounter = 0 Then
strAlertTitle = "Amber Alert"
strAlertDescription = "There are currently no amber alerts in Colorado."
End If
Next 'end loop
Response.Write(strAlertTitle & ": " & strAlertDescription & "<br /><br />")