question about xmlhttp and ASP

Discussion in 'C#' started by gworld, Apr 22, 2005.

  1. #1
    I am trying to get a rss feed with following code:


    Set xmlHTTP = Server.CreateObject("Microsoft.XMLHTTP")
    xmlHTTP.Open "GET",strXMLfile,false
    xmlHTTP.SetRequestHeader "Content-type", "text/xml"
    xmlHTTP.Send

    strXML = xmlHTTP.ResponseText


    As long as the server that provides the rss feed is running, then my script is fine but if rss feed server has a problem and doesn't respond, then I will get an error message

    msxml3.dll error '800c0008' when script executes xmlHttp.Send , how can I check the statue of rss feed server, so if it is not ready then I won't execute the xmlHTTP.Send?

    Thanks.
     
    gworld, Apr 22, 2005 IP
  2. iShopHQ

    iShopHQ Peon

    Messages:
    644
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If xmlHTTP.status = 200 Then strXML = xmlHTTP.ResponseText

    This checks to see if the GET returned a 200, which means the request has succeeded. To see a full list of potential response codes, check:

    http://kbs.cs.tu-berlin.de/~jutta/ht/responses.html
     
    iShopHQ, Apr 22, 2005 IP
  3. gworld

    gworld Prominent Member

    Messages:
    11,324
    Likes Received:
    615
    Best Answers:
    0
    Trophy Points:
    310
    #3
    ishopHQ

    Thank you. I will try it and thanks for the link also.
     
    gworld, Apr 22, 2005 IP