当前位置:网站首页>MiniAPI of .NET6 (14): Cross-domain CORS (Part 1)
MiniAPI of .NET6 (14): Cross-domain CORS (Part 1)
2022-08-03 22:25:00 【51CTO】
To illustrate cross-requests,创建了两个项目,一个mini api,端口是5001,另一个razor page项目,端口是5280.5280The item will be used on the pageajax的方式来请求5001,Form a cross-domain request,由于是本地测试,host都是localhost,So by port number is different,form different domains.
api项目
页面项目
运行结果:
默认情况下,只允许get,post,head三种方法,It is also possible to allow all method access.
运行结果:
All open cross-domain access,配置简单,但安全性较低,If you need to disable some resources that do not need to be accessed,可以在对应的url上放置DisableCors特性,To control cross-domain access.
运行结果
想要更快更方便的了解相关知识,可以关注微信公众号
边栏推荐
- mysql如何将表结构导出到excel
- pikachu Over permission
- Nine ways to teach you to read the file path in the resources directory
- How to write a database document management tool based on WPF (2)
- UVa 10003 - Cutting Sticks(白书,区间DP)
- 优化查询(工作中)
- 如何基于WPF写一款数据库文档管理工具(二)
- override学习(父类和子类)
- 生成器版和查看器版有什么区别?
- 直播预告 | 构建业务智联,快速拥抱财务数字化转型
猜你喜欢
2019年10月SQL注入的两倍
斩获双奖|易知微荣获“2021中国数字孪生解决方案优秀供应商”“中国智能制造优秀推荐产品”双奖项!
Embedded systems: overview
October 2019 Twice SQL Injection
嵌入式系统:概述
亿流量大考(2):开发一套高容错分布式系统
IO thread process -> thread synchronization mutual exclusion mechanism -> day6
如何创建一个Web项目
嵌入式系统:GPIO
On the Qixi Festival of 2022, I will offer 7 exquisite confession codes, and at the same time teach you to quickly change the source code for your own use
随机推荐
物联网新零售模式,引领购物新潮流
113. 授人以渔 - 如何自行查询任意 SAP UI5 控件属性的文档和技术实现细节
480. Sliding Window Median
LabVIEW代码生成错误 61056
IO thread process -> thread synchronization mutual exclusion mechanism -> day6
websocket多线程发送消息报错TEXT_PARTIAL_WRITING--自旋锁替换synchronized独占锁的使用案例
2022-08-03 oracle执行慢SQL-Q17对比
2019年10月SQL注入的两倍
Golang Chapter 1: Getting Started
2022-08-02 mysql/stonedb慢SQL-Q18-内存使用暴涨分析
L2-029 特立独行的幸福
.NET6之MiniAPI(十四):跨域CORS(上)
[b01lers2020]Life on Mars
October 2019 Twice SQL Injection
斩获双奖|易知微荣获“2021中国数字孪生解决方案优秀供应商”“中国智能制造优秀推荐产品”双奖项!
九种方式,教你读取 resources 目录下的文件路径
Canvas App中点击图标生成PDF并保存到Dataverse中
21天打卡挑战学习MySQL—Day第一周 第一篇
线上服务器老是卡,该如何优化?
UVa 1025 - A Spy in the Metro(白书)