asp.net允许跨域配置web.config

时间:2021-11-15 19:01:21
<configuration>
<system.webServer>
<modules>
<add name="CultureAwareHttpModule" type="Web_SJWD.Lang.CultureAwareHttpModule" />
</modules>
<validation validateIntegratedModeConfiguration="false" />
<!---加下面这段可以跨域--->
<httpProtocol>
<customHeaders>
<remove name="X-Powered-By" />
<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>
</configuration>

  转自:https://www.cnblogs.com/q149072205/p/11089954.html