Milind Nayse

Navigation

Skip navigation.

Search

Site navigation

Email conversation

FromMilind Nayse
ToMe
Subjectproblem using Microsoft.XMLHTTP
Date11 March 2006 12:13
Hi Mark
Your site is great for many people like thanks for such wonderful service.
 
My problem :  using Microsoft.XMLHTTP for Ajax.
 
I am new to this Ajax field. Just started reading it and have problem using
Microsoft.XMLHTTP.
I have read most of mail regarding Microsoft.XMLHTTP on your site and google
for it over a week now.
 
In this program I created a object Microsoft.XMLHTTP. and use this object to
fetch file which is on same machine.
This file is located in htdocs folder of http server. If call this using it
path (where it is save) then it work fine. 
But if I make a http request to call file, then first time it give me error
as "permission denied" and if refresh 
same page after this it show the contains of the file in the browser. I
lower all security setting for zones.
Microsoft.XMLHTTP the object get created. Javascript is working fine. I have
uderline and colored the where
I get the error it line no 30.
I try using this html file with and without of <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.0 Transitional//EN">
can solve this problem ...hope I have give you all reuired info.
 
My source code. : 
<html>
<head>
<script type='text/javascript'>
 
  var req=null;
  var console=null;
  var READY_STATE_UNINITIALIZED=0;
  var READY_STATE_LOADING=1;
  var READY_STATE_LOADED=2;
  var READY_STATE_INTERACTIVE=3;
  var READY_STATE_COMPLETE=4;
  function sendRequest(url,params,HttpMethod)
  {
    if (!HttpMethod)
    {
     HttpMethod="GET";
    }
  
    req=initXMLHTTPRequest();
    if (req)
    {
      req.onreadystatechange=onReadyState;
      req.open(HttpMethod,url,true);
      req.setRequestHeader("Content-Type",
"application/x-www-form-urlencoded");
      req.send(params);
    }
  }
 
  function initXMLHTTPRequest()
  {
   var xRequest=null;
   if (window.XMLHttpRequest)
   {
    xRequest=new XMLHttpRequest();
   } 
   else if (window.ActiveXObject)
   {
    xRequest=new ActiveXObject("Microsoft.XMLHTTP");
   }
   return xRequest;
  }
  
  function onReadyState()
  {
   var ready=req.readyState;
   var data=null;
   if (ready==READY_STATE_COMPLETE)
   {
    data=req.responseText;
   }
   else
   {
    data="loading...["+ready+"]";
   }
   toConsole(data);
  }
 
  function toConsole(data)
  {
   if (console!=null)
   {
    var newline=document.createElement("div");
    console.appendChild(newline);
    var txt=document.createTextNode(data);
    newline.appendChild(txt);
   }
  }
 
  window.onload=function()
  {
   console=document.getElementById('console'); 
   sendRequest("scan.txt");
  }
</script>
</head>
<body>
<div id='console'></div>
</body>
</html>

Browser I am using :
IE 6
Operating system :
Windows 2000

Error message in Internet Explorer:
Permission denied

Milind Nayse
FromMe
ToMilind Nayse
SubjectRe: problem using Microsoft.XMLHTTP
Date16 March 2006 11:55
Milind,

> But if I make a http request to call file, then first time it give me
> error as "permission denied" and if refresh
> same page after this it show the contains of the file in the browser.

Assuming all the pages are stored on the same server, I cannot see any
reason for this problem.

My IE 7 install gives that error but that is because it has a broken
window.XMLHttpRequest constructor. MY IE 5 install refuses to run any
scripts at all, so I am stuck. I cannot reproduce the problem.


Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/
FromMilind Nayse
ToMe
SubjectRe: problem using Microsoft.XMLHTTP
Date16 March 2006 16:33
Thanks for your reply. Now I tried to access the page with setting the
security in every zone to low.
When I run any Ajax related page from internet site they run fine. I access
same by clearing cache 
memory but no help. I think this might the problem of http server. Now I
will try it on apache server.
Thanks once again for your reply
Have nice day
Bye
FromMilind Nayse
ToMe
SubjectRe: problem using Microsoft.XMLHTTP
Date16 March 2006 17:11
Sorry to disturb you now and then. I got solution to problem using
Microsoft.XMLHTTP I had discuss with you earlier.
It's due to way I am accessing the page. I used to access the page using IP
address. instead of server name.
Sorry again as my stupid mistake consume your precious time looking for
solution.
  
Thanks and regards
Milind Nayse
This site was created by Mark "Tarquin" Wilton-Jones.
Don't click this link unless you want to be banned from our site.