"The system cannot locate the resource specified" error

Hello,

I am writing an asp application the uses javascript. The application is running in a secure mode (https).

In addition, i am using a XMLHTTP object and when i try to use it i get the following error:
"The system cannot locate the resource specified".
The url i am using for the XMLHTTP is also secure (https).

Any ideas what could be the problem?
Thank you,

Dana
RelegenceAsked:
Who is Participating?
 
sdkswatCommented:
Yes, Sure!

have you take a look at the link I sent above?

The code is:

-------------------------------------------------------------------------------------------------------------------
<%@language=Javascript %>
<%
var xmlHttp = new ActiveXObject("MSXML2.XMLHTTP");
function getSHTML(url){
  xmlHttp.Open("POST", url, false);
  xmlHttp.setRequestHeader("Accept-charset", "iso-8859-9");
  xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  xmlHttp.Send();

  var incHTML=xmlHttp.responseText;
  return(incHTML);
}


var url=Request.Form("url")
if(Request.Form("smt1")=='Fetch!')if(url!='' || url!=null)var incHTML=getSHTML(url)
//Response.Write(getSHTML())
%>

<html>
  <head>
 
  </head>
  <body>
    <form method=post action="">
      Fetch me secure: <input name=url value='<%=url%>'>
      <input name=smt1 type=submit value='Fetch!'>
      <a href="xmlsHttp.zip">Download the code</a>
    </form>
    <a style='font: bold 14 tahoma'>Response HTML:</a>
    <div style='border: solid orange 2; width: 100%; height: 200; overFlow: auto'><%=incHTML%></div><br>
    <a style='font: bold 14 tahoma'>Response Text:</a>
    <textarea style='border: solid green 2; width: 100%; height: 200'><%=incHTML%></textarea>
  </body>
</html>
-------------------------------------------------------------------------------------------------------------------

Let me know what's the problem?
0
 
sdkswatCommented:
Eeeem, you're right when you try to get some data via xmlHTTP, you must send the header information such as request type etc. when trying to reach SSL or https protocol

Let me think about it and come back in 30 minutes.
0
 
sdkswatCommented:
Hi relegence, I have just solved your problem

This is my delphi syntax but, as you know, xmlHTTP syntax is same everywhere
(If you get stuck, I can convert it into the javascript syntax but Beleive me, I have no time right now :-) )

Now, the coding must be like this

function getSHTML(url: String): WideString;
begin
  xmlHttp:=CreateOleObject('msxml2.xmlHTTP');
  if copy(url, 1, 8)<>'https://' then url:='https://'+url;
  xmlHttp.Open('POST', url, false);
  xmlHttp.setRequestHeader('Accept-charset', 'iso-8859-1');
  xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  xmlHttp.Send;
  result:=xmlHttp.responseText;
  xmlHTTP:=null;
end;

ShowMessage(getSHTML(Edit1.Text))

I have tested and It worked perfectly.
If you can not solve it, I can prepare a new asp-js script for you

Have fun ;-)
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
sdkswatCommented:
Hey, relegence, you can download the code from here.

---------------------------------------------------------------------------------------------------------------------
<%@language=Javascript %>
<%
var xmlHttp = new ActiveXObject("MSXML2.XMLHTTP");
function getSHTML(url){
  xmlHttp.Open("POST", url, false);
  xmlHttp.setRequestHeader("Accept-charset", "iso-8859-9");
  xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  xmlHttp.Send();

  var incHTML=xmlHttp.responseText;
  return(incHTML);
}
Response.Write(getSHTML('https://somehttpsaddress'))
%>
---------------------------------------------------------------------------------------------------------------------

It's just the Javascript syntax.

Have fun ;-)
0
 
RelegenceAuthor Commented:
Thank you very much.

I'll try to add it to my code now and let you know if it worked.

Thanks!!!!
0
 
sdkswatCommented:
Ooooo, I have forgotten to change the charset (It is encoded for Turkish Charset)
For English, just change this line:

xmlHttp.setRequestHeader("Accept-charset", "iso-8859-9");

this will be:
xmlHttp.setRequestHeader("Accept-charset", "iso-8859-1");
0
 
sdkswatCommented:
and the latest version:

http://212.174.25.207/sdkswat/tutorials/xmlHTTP/shttp/xmlsHttp.asp
You can check it out online ;-)

0
 
RelegenceAuthor Commented:
Unfortunately, It didn't work for me.
I am trying to use the object xmlHTTP on the server-side...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.