It seems you need to
Enable Cross-Origin Requests in ASP.NET Web API 2.
1) If you're using Visual Studio, then you can easily install the following Nuget package through Package Manager Console
Install-Package Microsoft.AspNet.WebApi.Cors
2) Then open the file
App_Start/WebApiConfig.cs. Add the following
config.EnableCors(); line code to the
WebApiConfig.Register method.
public static void Register(HttpConfiguration config)
{
config.EnableCors(); <-------
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
}
3) Finally, you can add the
[EnableCors] attribute on top of your Web API 2 Controller as followed:
using System.Web.Http.Cors;
namespace YourWebAPI2App.Controllers
{
[EnableCors("*", "*", "*")]
public class TestController : ApiController
{
....
You can check following link for more details on EnableCors options:
http://www.asp.net/web-api/overview/security/enabling-cross-origin-requests-in-web-api
Hope it helps
@MawashiKid