2014-09-10 57 views
2

我想通過傳遞憑據進行json調用。如果用戶已經登錄到使用SQL成員資格系統,我該怎麼憑據傳遞沒有得到這樣的:傳遞憑據不工作

log in image

這裏是調用web.api代碼:

注意:電話正在從跨域製成:即www.project.com - > api.project.com

var url = 'http://api.project.com/LookUps/uploadtypes?callback=?'; 

$.ajax({ 
    type: 'GET', 
    url: url, 
    async: true, 
    xhrFields: { 
     withCredentials: true 
    }, 
    jsonpCallback: 'handler', 
    contentType: "application/javascript", 
    dataType: 'jsonp', 
    success: function (json, textStatus, jqxhr) { console.log(jqxhr.responseText); }, 
    error: function (json, textStatus, jqxhr) { console.log(jqxhr.responseText); } 
}); 

編輯:

我仍然得到身份驗證被禁用時登錄。是否有另一個窗口認證設置的地方?

enter image description here

+0

彈出窗口用於Windows身份驗證。我認爲你需要爲部署在iis服務器上的api項目禁用Windows身份驗證。 – Priyank 2014-09-12 07:38:03

+0

你想要啓用Windows身份驗證嗎? – 2014-09-18 12:44:02

+0

我需要啓用基於表單的身份驗證。我試圖將我的web應用程序的憑據傳遞給web api項目。聲音它要求的用戶名和密碼,即使我作爲憑據傳入。 – jmogera 2014-09-18 13:57:13

回答