troubleshooting Question

XMLHTTP request to a password protected folder

Avatar of Kosta
Kosta asked on
5 Comments1 Solution2005 ViewsLast Modified:

My site is built with heavy use of AJAX.
The site's administration folder is password protected (using .htaccess autentication, PHP, Appachie).
When the user (site admin) enters to the "adm" folder, he get a prompt for a login name and a password. Then, on the page he is provided a possibility to delete some items, and this is done using an XMLHTTP request to a php script that resides in the same "adm" folder.
Everything works fine in both Firefox 2 and IE 6 until I activate a password protection of the "adm"  folder. Since I do it, Firefox starts to thow "Permission denied to call method" error. IE on my computer works, but the client's IE (probable another version) does not.

I found that the standards define a possibility to send a user name and a password with the "open" method of the XMLHTTPRequest. I failed to find any information about Firefox's support of this. And I found that some versions of IE have some problems with it. When I add a user name and a password arguments, IE give an "Invalid Syntax" error, and Firefox does not change anything and continue to give "Permission denied to call method" error.

What is the right, secure and reliable way of using XMLHTTP with a user authorization?

Here is my script:

            function getRequester()
                    var xmlHttp;
                      xmlHttp = new XMLHttpRequest();
                      var XmlHttpVersions = new Array("MSXML2.XMLHTTP.6.0",
                      for (var i=0; i < XmlHttpVersions.length && !xmlHttp; i++)
                          xmlHttp = new ActiveXObject(XmlHttpVersions[i]);
                        catch (e) {}
                    if (!xmlHttp)
                      alert("Error creating the XMLHttpRequest object.");
                      return xmlHttp;

            function del(y, m, n, spn){
      "GET", adr, true);


Thanks in advance. Kosta.
René Serradeil

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros