当前位置:网站首页>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:153162-70-0_N-BOC-6-Biotinamidohexylamine

一文带你了解软件测试是干什么的?薪资高不高?0基础怎么学?

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!

.NET6之MiniAPI(十四):跨域CORS(上)

Teach a Man How to Fish - How to Query the Properties of Any SAP UI5 Control by Yourself Documentation and Technical Implementation Details Demo

for循环练习题

Embedded Systems: Clocks

IO thread process -> thread synchronization mutual exclusion mechanism -> day6

PowerMockup 4.3.4::::Crack

投资性大于游戏性 NFT游戏到底是不是门好生意
随机推荐
UVa 10003 - Cutting Sticks (White Book, Interval DP)
382. Linked List Random Node
封装、包、访问权限修饰符、static变量
2022的七夕,奉上7个精美的表白代码,同时教大家快速改源码自用
Kubernetes入门到精通-Operator 模式
目标检测的国内外研究现状
.NET6之MiniAPI(十四):跨域CORS(上)
Data_web(八)mysql增量同步到mongodb
CAS:122567-66-2_DSPE-Biotin_DSPE-Biotin
斩获双奖|易知微荣获“2021中国数字孪生解决方案优秀供应商”“中国智能制造优秀推荐产品”双奖项!
UVa 437 - The Tower of Babylon(白书)
云计算国内外发展现状
HCIP BGP实验报告
九种方式,教你读取 resources 目录下的文件路径
113. Teach a Man how to fish - How to query the documentation and technical implementation details of any SAP UI5 control property by yourself
Cisco ike2 IPSec配置
Makefile
[b01lers2020]Life on Mars
嵌入式系统:概述
Bytebase数据库 Schema 变更管理工具