Lit*_*gon 3 asp.net-mvc kendo-ui asp.net-web-api kendo-upload
我已经在我的WEB API项目中启用了Cors!API控制器内的所有其他方法都可以从其他项目访问!
但是剑道上传器请求无法达到控制器方法
$("#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
});
Run Code Online (Sandbox Code Playgroud)
错误
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.
Run Code Online (Sandbox Code Playgroud)
这是我的角色
var cors = new EnableCorsAttribute("*", "*", "*");
config.EnableCors(cors);
Run Code Online (Sandbox Code Playgroud)
小智 9
尝试这种方式对我有用 .. 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
});Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1238 次 |
| 最近记录: |