|
发表于 2017-3-6 11:02:46
|
显示全部楼层
我使用的是ashx做接口的,在ashx里面加了
context.Response.ContentType = "textml;charset=utf-8"; //响应数据类型
context.Response.AddHeader("Access-Control-Allow-Origin","*");
context.Response.AddHeader("Access-Control-Allow-Methods","GET, POST, PUT, DELETE");
获取列表数据json时可以,上传图片时把attachmentSimple1的actionurl设成http://localhost:6661/Handler.ashx,点击浏览图片后,发现提示
XMLHttpRequest cannot load http://localhost:6661/Handler.ashx. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. |
|