"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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
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
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

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
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.