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

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

边栏推荐
猜你喜欢
随机推荐
用于流动质押和收益生成的 Web3 基础设施
Cisco ike2 IPSec configuration
嵌入式开发:嵌入式基础——代码和数据空间揭秘
LabVIEW code generation error 61056
Embedded systems: overview
2022的七夕,奉上7个精美的表白代码,同时教大家快速改源码自用
投资性大于游戏性 NFT游戏到底是不是门好生意
Teach a Man How to Fish - How to Query the Properties of Any SAP UI5 Control by Yourself Documentation and Technical Implementation Details Demo
嵌入式系统:GPIO
云平台建设解决方案
优化查询(工作中)
七夕快乐!
DO280管理和监控OpenShift平台--资源限制
Codeup brushing notes - simple simulation
[N1CTF 2018]eating_cms
Conditional Statements for Shell Programming
举一个 web worker 的例子
『百日百题 · 基础篇』备战面试,坚持刷题 第四话——循环语句!
Summary bug 】 【 Elipse garbled solution project code in Chinese!
How to write a database document management tool based on WPF (2)









