2017-04-24 36 views
0

我想打電話從.NET應用程序的API,但不幸的是我得到了一個錯誤:如果我測試的「高級休息的API得到錯誤,同時呼籲從.NET應用程序API

"Script7002:XMLhttpREQUEST:Network Error 0x80070005, Access Denied."

客戶端(ARC)「的Chrome擴展,然後我得到正確的響應。我該如何解決這個問題?

下面我給出了我用來從.NET應用程序調用API的代碼。

<script type = "text/javascript"> 
    function ShowCurrentTime() { 
     alert("start"); 

     $.ajax({ 
      url: "https://XXXXXXXXXXXX/api/xx/xxxxxx", 
      dataType: "application/json", 
      type: "POST", 
      data: { 
       "Username": "xxxxxx", 
       "Password": "xxxxxxx", 
       "Code": "xxx" 
      }, 

      success: function (r) { alert("success"); } 
     }); 

     alert("finished"); 
    } 
</script> 
+2

錯誤是因爲您沒有正確驗證API。您的具體做法取決於API的配置方式 –

回答

-1

嘗試在Internet Explorer中 此選項:

安全區域(Internet選項→安全)。啓用設置其他跨域訪問數據源

相關問題