over 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

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