博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Why ngx-uploader doesn't like to cooperate with .net core 2.x?
阅读量:4649 次
发布时间:2019-06-09

本文共 783 字,大约阅读时间需要 2 分钟。

The POST action seems to have no effect on the .net core controller.

If you put [IgnoreAntiforgeryToken] attribute on the server controller method, it works. But dont' leave it like that exposing vulnerability.

Turns out, Angular uses a particular header name "X-XSRF-TOKEN" to store token for the server to accept: 

The following client code snippet in the Angular 6 component works. It's just part of . Only to note the headers line.

const event: UploadInput = {type: 'uploadAll',url: this.UPLOAD_API_URL + '?guid=' + this.guid,method: 'POST',headers: {
'X-XSRF-TOKEN': this._cookieService.get("XSRF-TOKEN")},withCredentials: true,data: { foo: 'bar' }};

_cookieService is an injected service using . You may use any cookie tool.

转载于:https://www.cnblogs.com/dfun/p/9926407.html

你可能感兴趣的文章
Notepad++
查看>>
c语言第一次作业--分支 顺序结构
查看>>
一个PPT转H5的小工具
查看>>
java string 全角半角转换
查看>>
spring-boot:run启动报错
查看>>
多入参加法
查看>>
js 表单非空验证
查看>>
WebSocket是什么原理,为什么可以实现持久连接
查看>>
关于for of循环的用法和使用
查看>>
oracle的行转列和列转行
查看>>
AOJ 2249 Road Construction(Dijkstra+优先队列)
查看>>
BZOJ 1098 [POI2007]办公楼biu(反向图bfs+并查集优化)
查看>>
文件操作+函数基础day09
查看>>
ssh无密码登录设置方法以及出现问题 ECDSA host key 和IP地址对应的key不同的解决...
查看>>
Hibernate和MyBatis的对比
查看>>
Loadrunner 11 对Windows操作系统和浏览器的要求
查看>>
Python学习day8(文件操作)
查看>>
为什么 jmeter 分布式测试,一定要设置 java.rmi.server.hostname
查看>>
ASP.NET MVC5 网站开发实践(二) Member区域 - 用户部分(1)用户注册
查看>>
pandas介绍及环境部署
查看>>