来自Chrome的Web API调用OK,来自IE9的失败(DotNetNuke)

时间:2013-01-24 08:22:55

标签: ajax web-services dotnetnuke asp.net-web-api

我对此感到困惑。我正在编写一个Web API方法,当通过Chrome中的ajax调用时工作正常,但同样的调用在IE9中make时返回“Unauthorized”...我正在使用DotNetNuke 7的Web API实现,并且在调试中调用没有达到我的断点在方法“processUpload”中。可能导致这种情况的原因是什么?

以下是我的摘要,感谢您的帮助

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 :(得分: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">