kendo uploader Cross domain issue in Web.Api

混江龙づ霸主 提交于 2019-12-10 10:38:00

问题


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

        });

error

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.

here is my cors

 var cors = new EnableCorsAttribute("*", "*", "*");
            config.EnableCors(cors);

回答1:


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
        });


来源:https://stackoverflow.com/questions/32433185/kendo-uploader-cross-domain-issue-in-web-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!