当前位置:网站首页>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.
运行结果

想要更快更方便的了解相关知识,可以关注微信公众号

边栏推荐
- CAS: 773888-45-2_BIOTIN ALKYNE_Biotin-alkynyl
- E-commerce data warehouse ODS layer-----log data loading
- L2-029 特立独行的幸福
- 优化查询(工作中)
- FVCOM 3D Numerical Simulation of Hydrodynamics, Water Exchange, Dispersion and Transport of Oil Spills丨FVCOM Model Watershed, Numerical Simulation Method of Marine Water Environment
- LabVIEW code generation error 61056
- 生成器版和查看器版有什么区别?
- HCIP第十四天
- 2022-08-03 Oracle executes slow SQL-Q17 comparison
- UVa 10003 - Cutting Sticks (White Book, Interval DP)
猜你喜欢

CAS:153162-70-0_N-BOC-6-Biotinamidohexylamine

投资性大于游戏性 NFT游戏到底是不是门好生意

藏宝计划TreasureProject(TPC)系统模式开发技术原理

Embedded Systems: Clocks

数据一致性:双删为什么要延时?

Bytebase database schema change management tool

七夕快乐!

Go开发工具GoLand V2022.2 来了——Go 工作区重大升级

2022-08-02 mysql/stonedb慢SQL-Q18-内存使用暴涨分析

Boss: There are too many systems in the company, can you realize account interoperability?
随机推荐
LabVIEW代码生成错误 61056
21天打卡挑战学习MySQL——《Window下安装MySql》第一周 第三篇
目标检测的国内外研究现状
用于流动质押和收益生成的 Web3 基础设施
FinClip最易用的智能电视小程序
PowerMockup 4.3.4::::Crack
嵌入式开发:嵌入式基础——代码和数据空间揭秘
.NET6之MiniAPI(十四):跨域CORS(上)
472. Concatenated Words
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
Causes of Mysql Disk Holes and Several Ways to Rebuild Tables
386. Lexicographical Numbers
October 2019 Twice SQL Injection
385. Mini Parser
HCIP第十五天
L2-029 特立独行的幸福
全球观之地理部分
CAS:153162-70-0_N-BOC-6-Biotinamidohexylamine
21天打卡挑战学习MySQL—Day第一周 第一篇
for loop exercises