Advertisement

03.25.2008 at 06:15AM PDT, ID: 23266819
[x]
Attachment Details

Why Ajax call in Safari, xmlHttpRequest.open("POST", testURL, false, username, password), throwing Permission Denied error?

Asked by Everywhere2 in WebApplications, JavaScript, Safari Web Browser

Tags: javascript, Ajax, IE, Firefox, Safari

Following code is working well for IE and FireFox. But for Safari,
userCheckRequest.open("POST", checkURL, false, un, pw);
throws "Permission Denied" exception. This function  is called in the OWA, https://TestServer/exchange.
Any suggestions and solutions would be appreciated. Thanks.

// web applicaton, TestApp has a web method in XML Web Service, the url is,
//'https://TestServer/TestApp/ValidateUser.asmx/IsUserValid'
// following function calls the web method from OWA, 'https://TestServer/exchange'
function DoCheckUser()
{
    var ReturnXML =null;
    var checkURL = "https://TestServer/TestApp/ValidateUser.asmx/IsUserValid";
    var userCheckRequest;
      userCheckRequest = CreateXMLHTTP();

      try
      {
            var un = "testDomain\\testUser";
            var pw = "testPass";

            try
            {
                  userCheckRequest.open("POST", checkURL, false, un, pw);                        
            }
            catch (e)
            {
                  alert("Error 1 - " + e);
            }
            try
            {
                  userCheckRequest.send("");
                  if( !userCheckRequest.responseText )
                  {
                        return false;
                  }
                  ReturnXML=CreateXMLParser(userCheckRequest.responseText);
            }
            catch (e)
            {
                  alert("Error 2 - " + e);
                  return false;      
            }

            try
            {
                  if(!ReturnXML)
                  {
                        return false;
                  }
                  if(!ReturnXML.firstChild || !ReturnXML.firstChild.nodeValue)
                  {
                        return false;
                  }
                  returnVal = ReturnXML.firstChild.nodeValue;
                  if( returnVal == "true" )
                  {      
                        return true;
                  }
                  else
                  {
                        return false;
                  }
            }            
            catch(e)
            {
                  alert("Error 3 - " + e);
                  return false;      
            }
            return false;
      }            
      catch(e)
      {
            alert("Error 4 - " + e);      
            return false;      
      }
}

function CreateXMLHTTP()
{
      var objHttpRequest = "undefined";
      if (window.ActiveXObject)
      {            
            try
            {
                  objHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");      
            }
            catch(e)
            {
                  objHttpRequest = new ActiveXObject("Microsoft.xmlhttp");
            }
      }
      else
      {
            try
            {            
                  objHttpRequest = new XMLHttpRequest();
            }
            catch(e)
            {
                  alert(e);                  
            }      
      }
      return objHttpRequest;
}

function CreateXMLParser(text)
{
      var x="undefined";
      var doc = null;
      if (window.ActiveXObject)
      {
            
            try{
                  doc = new ActiveXObject("Msxml2.DOMDocument");
            }
            catch(e)
            {
                  
                  doc=new ActiveXObject("Microsoft.XMLDOM");
            }            
            try
            {
                  doc.async="false";
                  doc.loadXML(text);
            }
            catch (e)
            {
                  alert( 'loading xml threw exception: ' + e );
            }
            
      }
      else
      {
            var parser=new DOMParser();
            doc=parser.parseFromString(text,"text/xml");
      }
      x = doc.documentElement;
      return x;
}Start Free Trial
[+][-]03.30.2008 at 04:08AM PDT, ID: 21240276

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]03.30.2008 at 10:04PM PDT, ID: 21243246

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.31.2008 at 06:23AM PDT, ID: 21245050

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.03.2008 at 10:10PM PDT, ID: 21279181

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: WebApplications, JavaScript, Safari Web Browser
Tags: javascript, Ajax, IE, Firefox, Safari
Sign Up Now!
Solution Provided By: b0lsc0tt
Participating Experts: 3
Solution Grade: A
 
 
[+][-]07.08.2008 at 08:56AM PDT, ID: 21955085

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.08.2008 at 10:28PM PDT, ID: 21960799

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.19.2008 at 01:01AM PDT, ID: 22041755

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628