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

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

边栏推荐
猜你喜欢
随机推荐
mysql如何将表结构导出到excel
CAS:1260586-88-6_Biotin-C5-Azide_Biotin-C5-Azide
老板:公司系统太多,能不能实现账号互通?
图的基础概念
Embedded systems: overview
483. Smallest Good Base
488. Zuma Game
生成器版和查看器版有什么区别?
480. Sliding Window Median
noip preliminary round
Flutter 桌面探索 | 自定义可拖拽导航栏
encapsulation, package, access modifier, static variable
【MySQL进阶】数据库与表的创建和管理
[b01lers2020]Life on Mars
FinClip最易用的智能电视小程序
优化查询(工作中)
[MySQL Advanced] Creation and Management of Databases and Tables
HCIP第十三天
385. Mini Parser
全球观之地理部分








