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!
Asked
Active
Viewed 1,685 times
0
-
I don't think so @Mikev, look at the tags, he doesn't ask for .NET Core specifically – marijnz0r Mar 19 '19 at 14:31
1 Answers
0
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.

marijnz0r
- 934
- 10
- 23