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

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

边栏推荐
猜你喜欢

pikachu Over permission 越权

【开源框架】国内首个通用云计算框架,任意程序都可做成云计算。

CAS: 773888-45-2_BIOTIN ALKYNE_Biotin-alkynyl

直播预告 | 构建业务智联,快速拥抱财务数字化转型

PowerMockup 4.3.4::::Crack

关于IDO预售系统开发技术讲解丨浅谈IDO预售合约系统开发原理分析

CAS:1797415-74-7_TAMRA-Azide-PEG-Biotin

获国际权威认可 | 云扩科技入选《RPA全球市场格局报告,Q3 2022》

Data_web(九)mongodb增量同步到mongodb
![[b01lers2020]Life on Mars](/img/d0/d5c9b7224542c8843ce29adc7ef713.png)
[b01lers2020]Life on Mars
随机推荐
Codeup brushing notes - simple simulation
关于Yii2批量更新的操作
2022-08-03 oracle执行慢SQL-Q17对比
【云原生实用技巧】使用 skopeo 批量同步 helm chart 依赖镜像
老板:公司系统太多,能不能实现账号互通?
Optimize the query (work in progress)
一些思考:腾讯股价为何持续都低
mysql如何将表结构导出到excel
L2-041 插松枝
嵌入式开发:嵌入式基础——代码和数据空间揭秘
382. Linked List Random Node
HDU 5655 CA Loves Stick
重发布实验报告
Lift, Splat, Shoot: Encoding Images from Arbitrary Camera Rigs by Implicitly Unprojecting to 3D 论文笔记
UVa 10003 - Cutting Sticks (White Book, Interval DP)
UVa 1025 - A Spy in the Metro (White Book)
21天打卡挑战学习MySQL——《Window下安装MySql》第一周 第三篇
LabVIEW代码生成错误 61056
Diazo Biotin-PEG3-DBCO | Diazo Compound Modified Biotin-Tripolyethylene Glycol-Dibenzocyclooctyne
九种方式,教你读取 resources 目录下的文件路径