Web.Api 中的剑道上传器跨域问题 [英] kendo uploader Cross domain issue in Web.Api
本文介绍了Web.Api 中的剑道上传器跨域问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经在我的 WEB API 项目中启用了 Cors!API 控制器中的所有其他方法都可以从其他项目访问!
i already enable the Cors in my WEB API project ! all other methods inside the API controller can access from the other project !
但剑道上传请求无法到达控制器方法
but kendo uploader request can not reach to the controller method
$("#files").kendoUpload({
async: {
xhrFields: {
withCredentials: true
},
saveUrl: 'http://localhost:23618/API/test/UploadAttachment',
removeUrl: 'http://localhost:23618/API/test/RemoveAttachment',
autoUpload: true
},
upload: function (e) {
e.data = { contactID: 5 };
},
error: onError
});
错误
A wildcard '*' cannot be used in the 'Access-Control-Allow-Origin' header when the credentials flag is true. Origin 'http://localhost:23617' is therefore not allowed access.
这是我的cors
var cors = new EnableCorsAttribute("*", "*", "*");
config.EnableCors(cors);
推荐答案
尝试这种方式对我有用..http://docs.telerik.com/KENDO-UI/api/javascript/ui/upload#configuration-async.withCredentials
Trying it this way worked for me.. http://docs.telerik.com/KENDO-UI/api/javascript/ui/upload#configuration-async.withCredentials
$("#files").kendoUpload({
multiple: false,
async: {
withCredentials: false,
saveUrl: "url",
autoUpload: true
},
success: onSuccess
});
这篇关于Web.Api 中的剑道上传器跨域问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文