In this article, I will explain how to avoid cross-origin error in Web API.
Just add "cors" packages from NuGet package manager and add this code in WebApiConfig.cs file.
Just add "cors" packages from NuGet package manager and add this code in WebApiConfig.cs file.
using System.Web.Http.Cors; public static class WebApiConfig { public static void Register(HttpConfiguration config) { var corsAttr = new EnableCorsAttribute(BusLib.Config.Configuration.CorsOrigin, "*", "*"); config.EnableCors(corsAttr); } }
Comments
Post a Comment