更新时间:2021-10-16 22:14:20
通常,我读到的帖子建议了几个不必要的配置步骤,这造成了混乱.其实很简单...
Oftentimes, the threads that I read were suggesting several unecessary configuration steps, which created confusion. It's actually very simple...
为了简单的目的,从 Angular 客户端向 ASP 控制器发送跨站点请求:
For the simple purpose of sending a cross site request, from an angular client, to an ASP controller :
唯一的强制修改是在服务器的 web.config 中添加这个
The only mandatory modification is to add this in the server's web.config
<system.webServer>
<httpProtocol>
<customHeaders>
<clear />
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Headers" value="Content-Type"/>
</customHeaders>
</httpProtocol>
</system.webServer>