当前位置:网站首页>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
21天打卡挑战学习MySQL——《MySQL工具的使用》第一周 第二篇
Summary bug 】 【 Elipse garbled solution project code in Chinese!
CAS:1260586-88-6_Biotin-C5-Azide_Biotin-C5-Azide
物联网新零售模式,引领购物新潮流
FinClip最易用的智能电视小程序
2022-08-03 oracle执行慢SQL-Q17对比
What is Adobe?
Bytebase数据库 Schema 变更管理工具
Gains double award | know micro easily won the "2021 China digital twin solution suppliers in excellence" "made in China's smart excellent recommended products" double award!
随机推荐
FinClip最易用的智能电视小程序
一个函数有多少种调用方式?
Golang Chapter 2: Program Structure
HCIP第十三天
藏宝计划TreasureProject(TPC)系统模式开发技术原理
目标检测的国内外研究现状
Cisco ike2 IPSec配置
Unification of east-west and north-south communications
Nine ways to teach you to read the file path in the resources directory
382. Linked List Random Node
目标检测技术研究现状及发展趋势
HCIP BGP实验报告
Flink--Join以及Flink函数
VIM操作
投资性大于游戏性 NFT游戏到底是不是门好生意
易观分析:2022年Q2中国网络零售B2C市场交易规模达23444.7亿元
Bytebase database schema change management tool
CAS:908007-17-0_Biotin-azide_Biotin azide
Causes of Mysql Disk Holes and Several Ways to Rebuild Tables
483. Smallest Good Base