xmlhttp.Send problem
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: xmlhttp.Send problem

  1. #1
    Join Date
    Mar 2007
    Posts
    3

    xmlhttp.Send problem

    Help!

    when doing the following- xmlhttp.Send(xmlSend);
    on this object- var xmlhttp = new ActiveXObject("MsXml2.XmlHttp")

    I sometimes get an error (after an IIS reset) that-
    “The download of the specified resource has failed”
    but sometimes it works.

    I've read that it may be due to the version of MSXML that I'm using, but I've tried different versions- (MSXML2.XMLHTTP.6.0) and it doesnt seem to make a difference.

    Any idea why this is happening?
    (The xml I'm sending is always the same and is ok)

    thanks

  2. #2
    PeejAvery's Avatar
    PeejAvery is offline Super Moderator Power Poster
    Join Date
    May 2002
    Posts
    10,840

    Re: xmlhttp.Send problem

    This is an AJAX problem, I will have it moved there. I would suggest using the following code to call your AJAX XML initialization.

    Code:
      var xmlHttp;
      try{xmlHttp = new XMLHttpRequest();}
      catch(e){
        try{xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");}
        catch(e){
          try{xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");}
          catch(e){
            alert("Your browser does not support AJAX!");
            return false;
          }
        }
      }
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  3. #3
    Join Date
    Mar 2007
    Posts
    3

    Re: xmlhttp.Send problem

    PeejAvery, thank you for the reply,

    but it didn't help solve my problem.

    I do not fail on the object creation, but on the send function.

    the browser supports ajax because it works some of the time, and even if it didnt, catching the exception wouldnt help me solve the problem.

    thanks

  4. #4
    PeejAvery's Avatar
    PeejAvery is offline Super Moderator Power Poster
    Join Date
    May 2002
    Posts
    10,840

    Re: xmlhttp.Send problem

    Can you please post the whole sending function? Are there any abnormalities that happen when it fails besides the IIS reset? Is the reset a server problem or user initiated?
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  5. #5
    Join Date
    Mar 2007
    Posts
    3

    Re: xmlhttp.Send problem

    The problem happens after I initiate an IIS reset. There are no other abnormalities.


    a very important thing I neglected to mention- the page I give as url to send to is an aspx with .net code in its CS.


    function xmlSyncHttpReq(sURL, xmlSend, bThrowExc){
    try{
    var xmlhttp = new ActiveXObject("MsXml2.XmlHttp.6.0");
    xmlhttp.Open("POST", sURL, false);

    problem is here- xmlhttp.Send(xmlSend);

    if(xmlhttp.responseXML.documentElement){
    if (checkHTTPErrors(xmlhttp.responseXML)) return false;
    else return xmlhttp.responseXML.documentElement;
    }

    xmlhttp = null;
    return true;
    }catch(e){
    if (bThrowExc)throw e;
    else alert(e.description);
    }
    }

    thanks again

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center