about 2 years ago

When you use ajax call an ASP.NET Web Application API

No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.

If you have the same issue.Hope these codes can help to slove problem.

Add these code to Web.config

<system.webServer>
    <httpProtocol>
        <customHeaders>
        <add name="Access-Control-Allow-Methods"  value="GET,POST" />
        <add name="Access-Control-Allow-Origin" value="*" />
        <add name="Access-Control-Allow-Headers" value="Content-Type" />
        </customHeaders>
    </httpProtocol>
</system.webServer>
← Android 如何清除專案 Clean Project Mac OSX 變更 php 版本 →
 
comments powered by Disqus