Hi,
The intranet shows news by taking a feed from a URL. In case the URL is down, I would like to display a message indicating that the URL is down instead of crashing the intranet.
This is in JScript & ASP.
I get the error:
I call the above function in the following way:
Thanks.
The intranet shows news by taking a feed from a URL. In case the URL is down, I would like to display a message indicating that the URL is down instead of crashing the intranet.
This is in JScript & ASP.
Code:
/*********************************************
CORE XMLHTTPREQUEST OBJECT
Grabs an XML document, and converts it to a XMLDOM
object so that it can be parsed with DOM methods.
*********************************************/
function getXMLObject(url) {
var xmlhttp, xmldoc;
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (E) {
xmlhttp = false;
}
}
xmlhttp.open("GET", url, false);
//xmlhttp.send(null);
//Added Error Trapping in case the RSS Feed is down so that intranet does not crash.
//Status of 200 means that the URL exists
if (xmlhttp.status != 200) {
Response.Write ("URL is down");
}
else {
xmldoc=Server.CreateObject("Microsoft.XMLDOM");
xmldoc.async=false;
xmldoc.loadXML(xmlhttp.ResponseText);
return xmldoc;
}
xmlhttp.send(null);
}
I get the error:
Code:
msxml3.dll error '80004005'
Unspecified error
/inc/RSSParserTest.inc, line 29
I call the above function in the following way:
Code:
<script language="JScript" runat="Server">
// Create XML Object
var rssURL = "[URL unfurl="true"]www.cnn1.com"[/URL]
var newsURL = getXMLObject(rssURL);
</script>
Thanks.