I have a simple method accessible by this url:
http://localhost/SeuropWebWebApi/test
If I access it directly throug the browser, I get the response...
The problem comes when I ask the method from my Angular2 application, I try to make a simple request and the response is:
Code: 200 with empty response
If I try to intercept the call using Visual Studio, I notice that the method is not firing...
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost/****/Test. (Reason: CORS header ‘Access-Control-Allow-Origin’ does not match ‘(null)’).
I think that the problem comes from webapi configuration, I tried to enable CORS call using this tag in webconfig:
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
</customHeaders>
</httpProtocol>
and in WebApiConfig Register method:
Dim cors As New System.Web.Http.Cors.EnableCorsAttribute("*", "*", "*")
config.EnableCors()
But nothing works...
Thanks to support