美文网首页
C#解决ajaxs跨域问题

C#解决ajaxs跨域问题

作者: 深夜程序员_ | 来源:发表于2020-04-06 14:40 被阅读0次

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

<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>

相关文章

网友评论

      本文标题:C#解决ajaxs跨域问题

      本文链接:https://www.haomeiwen.com/subject/jfhbphtx.html