Skip to main content

Posts

Showing posts from February, 2016

Handle no 'Access-Control-Allow-Origin' - issues on client side in ASP.NET WebAPI

Since your .NET Web API and Client-Side projects are being hosted on different ports, it's considered a Cross-Domain (CORS) request. Just add the proper header in your   web.config   from your web API application: <configuration> < system . webServer > <httpProtocol> <customHeaders> < add name = "Access-Control-Allow-Origin" value = "*" /> < add name = "Access-Control-Allow-Headers" value = "Content-Type" /> < add name = "Access-Control-Allow-Methods" value = "GET, POST, PUT, DELETE, OPTIONS" /> </ customHeaders > </ httpProtocol > </ system . webServer > </ configuration >