Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
WebApiConfig with added CORS configuration
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
using System.Web.Cors;
using System.Web.Http.Cors;
namespace Itsp365.InvoiceFormApp.Api
public static class WebApiConfig
public static void Register(HttpConfiguration config)
// Web API configuration and services
var corsConfiguration = new EnableCorsAttribute("http://localhost:8080,,", "*", "*");
// Web API routes
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment