Reputation: 157
I have an API developed using ASP.NET WebForms C# Technology, API is returning the response perfectly however I am getting the response in AJAX due to Cross Origin Request error. Can anyone please guide me on fixing it.
Upvotes: 1
Views: 4072
Reputation: 1349
in your web.config add
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Methods" value="GET, POST, OPTIONS, PUT, DELETE" />
</customHeaders>
</httpProtocol>
</system.webServer>
Upvotes: 5