asp.netMVC解决ajaxs跨域问题

2022-08-17 14:12:32 浏览数 (1)

在web.config中的<system.webServer>接点下面配置

代码语言:javascript复制
<system.webServer>
    <httpProtocol>
          <customHeaders>
            <clear />
            <add name="Access-Control-Allow-Methods" value="OPTIONS,POST,GET" />
            <add name="Access-Control-Allow-Headers" value="x-requested-with,content-type" />
            <add name="Access-Control-Allow-Origin" value="*" />
          </customHeaders>
     </httpProtocol>
     <directoryBrowse enabled="true" />
  </system.webServer>

0 人点赞