asp.net允许跨域配置web.config
<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>
一直提示不能跨域,在web.config里加入上面这段后,就可以允许跨域访问了。
欢迎加入JAVA技术交流QQ群:179945282
欢迎加入ASP.NET(C#)交流QQ群:17534377