I am working on WebApi and CORS is enabled for WebAPI.config level but it is not enabled for MVC Controller? I am not asking about .Net CORE!
1 Answer
It says:
using System.Net.Http;
using System.Web.Http;
using System.Web.Http.Cors;
namespace WebService.Controllers
{
[EnableCors(origins: "http://mywebclient.azurewebsites.net", headers: "*", methods: "*")]
public class TestController : ApiController
{
// Controller methods not shown...
}
}
So use the EnableCors attribute. Good luck.