2013-01-24 51 views
3

我對此感到莫名其妙。我正在編寫一個Web API方法,當在Chrome中通過ajax調用時工作正常,但在IE9中進行同樣的調用時會返回「未授權」...我使用DotNetNuke 7的Web API實現,並且在調試過程中,調用不會觸發我的斷點在「processUpload」方法中。什麼可能導致這種情況?從Chrome瀏覽器調用Web API,從IE9失敗(DotNetNuke)

這裏是我的片段,感謝您的幫助

data = { alc: 'private', bucket: 'Dev', file: file.name, key: 'drop/' }; 
$.ajax({ 
    url: sf.getServiceRoot('mySite') + "Upload/processUpload", 
    type: 'POST', 
    data: data, 
    beforeSend: sf.setModuleHeaders 
}).done(function (response, status) { 
    if (status == "success") { 
     params[response.file] = { policy: response.policy, signature: response.signature } 
    } 
}).fail(function (xhr, result, status) { 
    alert("Uh-oh, something broke: " + status); 
}); 
+1

你也許用一個瀏覽器登錄過,而不是在另一個瀏覽器中登錄? –

回答

0

這是我的Ajax調用看起來像

odata = { alc: 'private', bucket: 'Dev', file: file.name, key: 'drop/' }; 
    $.ajax({ 
     type: "POST", 
     contentType: "application/json;charset=utf-8", 
     url: sf.getServiceRoot('mySite') + "Upload/processUpload", 
     beforeSend: sf.setModuleHeaders, 
     data: odata , 
     success: function (result) { 
      params[response.file] = { policy: response.policy, signature: response.signature } 
     }, 
     error: function (xhr, status, error) { 
    alert("Uh-oh, something broke: " + xhr.responseText); 
     } 
    }); 

什麼,你也可以嘗試在修改你的web.config如下

<modules runAllManagedModulesForAllRequests="true"> 
相關問題