Msxml3.dll: loading of the specified resource failed - when using XMLHTTP

I have a java script code snippet where I make an XMLHTTP request to a remote server page. Below is my code

    var objXMLdom = new ActiveXObject("Microsoft.XmlDOM")
    var objXMLRecdom = new ActiveXObject("Microsoft.XmlDOM")
    objXMLdom.async = false
    var objXMLRoot = objXMLdom.createElement("root");           
    objXMLdom.documentElement = objXMLRoot;

    objXMLRoot.setAttribute("strWoCode",id);
    var objXMLHttp = new ActiveXObject("Microsoft.XMLHTTP");
    strHTTP = "getDataResponse.aspx?wocode="+strWoCode+"&mode="report";     
    objXMLHttp.open("POST",strHTTP,false)
    objXMLHttp.send(objXMLdom); 

When the last line (send ()) is executed, the error message "msxml3.dll: loading of the specified resource failed." Appears. My development machine runs on Win XP SP 2

Can anyone help get rid of this?

+3
source share
1 answer

The problem is caused by strHTTP variable. It must contain the full URL. Also, be sure to encode the strWoCode variable to prevent URL injection.

strHttp = "http://www.mywebsite.com/getDataResponse.aspx?";
strHTTP = strHTTP + "wocode="+encodeURIComponent(strWoCode)+"&mode="report";    
0
source

Source: https://habr.com/ru/post/1717334/


All Articles