在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
Web.config 下<system.webServer> 节点下配置 <httpProtocol> <customHeaders> <add name="Access-Control-Allow-Origin" value="http://localhost:60699" /> <add name="Access-Control-Allow-Headers" value="*" /> <add name="Access-Control-Allow-Methods" value="GET, POST, PUT, DELETE" /> </customHeaders> </httpProtocol>
设置允许跨域传递Cookie <system.webServer> <httpProtocol> <customHeaders> <add name="Access-Control-Allow-Origin" value="http://localhost:8080" /> <add name="Access-Control-Allow-Headers" value="content-type" /> <add name="Access-Control-Allow-Methods" value="*" /> <add name="Access-Control-Allow-Credentials" value="true"/> </customHeaders> </httpProtocol> </system.webServer> 前端 请求的时候需设定:withCredentials = true; 设置了widthCredentials为true的请求中会包含远程域的所有cookie |
请发表评论