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: https://docs.microsoft.com/en-us/aspnet/core/security/anti-request-forgery?view=aspnetcore-2.1#angularjs

The following client code snippet in the Angular 6 component works. It's just part of ngx-uploader sample code. 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 ngx-cookie. You may use any cookie tool.

Why ngx-uploader doesn't like to cooperate with .net core 2.x?的更多相关文章

  1. ngx.shared.DICT.incr 详解

    ngx.shared.DICT.incr 原文: ngx.shared.DICT.incr syntax: newval, err, forcible? = ngx.shared.DICT:incr( ...

  2. Ningx代码研究.

    概述 研究计划 参与人员 研究文档 学习emiller的文章 熟悉nginx的基本数据结构 nginx 代码的目录结构 nginx简单的数据类型的表示 nginx字符串的数据类型的表示 内存分配相关 ...

  3. Nginx+lua+openresty精简系列

    1. CentOS系统安装openresty 你可以在你的 CentOS 系统中添加 openresty 仓库,这样就可以便于未来安装或更新我们的软件包(通过 yum update 命令).运行下面的 ...

  4. ngx.lua中遇到的小问题2

    用lua+drizzle在数据库中插入数据失败(不能访问数据库) 后面发现原来是nginx配置文件中的drizzle模块部分最后多了一行  content_by_lua 'ngx.say(" ...

  5. Mvc利用淘宝Kissy uploader实现图片批量上传附带瀑布流的照片墙

    前言 KISSY 是由阿里集团前端工程师们发起创建的一个开源 JS 框架.它具备模块化.高扩展性.组件齐全,接口一致.自主开发.适合多种应用场景等特性.本人在一次项目中层使用这个uploader组件. ...

  6. Web Uploader - 功能齐全,完美兼容 IE 的上传组件

    文件上传是网站和 Web 应用程序的常用功能,一直没有一款完美的文件上传组件,因此让很多开发人员碰到头疼的浏览器兼容问题. WebUploader 是由 Baidu FEX 团队开发的一款以 HTML ...

  7. 多图上传 - Web Uploader

    http://fex.baidu.com/webuploader/   官方DEMO,我都不想说了,各种问题.参考ShuaiBi文章   http://www.cnblogs.com/ismars/p ...

  8. ngx.lua中遇到的小问题

    作者: 胡 志伟 分类: ngx_lua, 开发代码 发布时间: 2013-09-26 08:40 ė 6评论关闭 在使用ngx.redirect 到一个新的地址时,错误日志提示: lua entry ...

  9. 使用的组件:Web Uploader

    Web UploaderWebUploader是由Baidu WebFE(FEX)团队开发的一个简单的以HTML5为主,FLASH为辅的现代文件上传组件.在现代的浏览器里面能充分发挥HTML5的优势, ...

随机推荐

  1. docker备份mongodb数据,导入导出

    场景:服务器要升级,之前在linux部署的mongodb没有用docker,升级后,mongodb要用docker部署,并将原有的mongodb数据导入到docker部署的mongodb中. 1.在l ...

  2. 02-Python入门学习-变量

    一.编程语言介绍1.机器语言:直接用二进制编程,直接控制硬件,需要掌握硬件的操作细节优点:执行效率高缺点:开发效率低 2.汇编语言:用英文标签取代二进制指令去编写程序,直接控制硬件,需要掌握硬件的操作 ...

  3. Java反射通过getter和setter方法实现类的拷贝

    private User copyFieldValues(User userData, User user) { Field[] fields = user.getClass().getDeclare ...

  4. List GroupBy真实用法,Reflection(反射)用法,Enum用法,正则,搜索下拉布局

    1.List  GroupBy 用法 var _roomProducts = homesingProducts.GroupBy(t => t.RoomName); RoomedProducts ...

  5. 19.3.20 解决pycharm快捷键无法使用问题和熟悉git与码云操作流程

    problem:由于Vim插件导致快捷键无法使用: answer:settings→Plugins→搜索到ideaVim→取消选中→apply→重启pycharm: git:创建仓库→生成公钥(ssh ...

  6. Web Api使用Swagger提供在线文档

    1.添加Swashbuckle引用 2.生成XML文件 3.添加XML解析,在接口添加注释信息 4.运行项目输入地址   http://localhost:58254/swagger

  7. spring mvc 总结

    依赖包 <!-- spring依赖 --> <dependency> <groupId>org.springframework</groupId> &l ...

  8. socks-proxy---with ssh

    socks-proxy---with sshhttps://blog.csdn.net/scien2011/article/details/54562501

  9. Git最牛最全详解

    阅读目录 Git是什么    SVN与Git的最主要的区别    在windows上如何安装Git    如何操作    创建版本库    把文件添加到版本库中    版本回退    理解工作区与暂存 ...

  10. poj2688

    #include<iostream> using namespace std; #include<time.h> int m,n; ][]; ][]; typedef stru ...