.net解决跨域问题


把下面的代码放在web.config文件中的 system.webServer 节点下

<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Headers" value="*" />
<add name="Access-Control-Allow-Methods" value="GET, POST, PUT, DELETE" />
</customHeaders>
</httpProtocol>

 

如果没有system.webServer节点  就在  </system.web>下面创建一个system.webServer

<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Headers" value="*" />
<add name="Access-Control-Allow-Methods" value="GET, POST, PUT, DELETE" />
</customHeaders>
</httpProtocol>
</system.webServer>

.net解决跨域问题

上一篇:HTTP/2、3的特点


下一篇:Webpack 性能优化