1
Hello,
I have a mistake and I can’t fix it. I have an ASP NET-MVC5 application and I carry a frame in my view that has some fonts, but they are giving the following error:
Access to font at 'https://www.fontteste/fonts/Bold.woff' from origin 'http://localhost:62688' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested Resource
I’ve already put in my "web config." the following excerpt, but without success:
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Headers" value="*" />
</customHeaders>
</httpProtocol>
Could you help me ?
Tries to change the file
applicationHost.config
placing your customHeader in a hidden folder of your project: "Seu_projeto.vs config applicationhost.config"– Victor Laio
I include, but still the error remains :(
<httpProtocol>
 <customHeaders>

 <clear />
 <add name="X-Powered-By" value="ASP.NET" />
 <add name="Access-Control-Allow-Origin" value="*" />
 <add name="Access-Control-Allow-Headers" value="*" />
 <add name="Access-Control-Allow-Methods" value="GET,POST,PUT" />
 </customHeaders>
 <redirectHeaders>
 <clear />
 </redirectHeaders>
 </httpProtocol>
– Vinicius Santos
Can you add more details (add controller and html to your page)? It will help the final answer, but, you have already tried to add the Microsoft.AspNet.Webapi.Cors package and add the attribute to your controller [Enablecors]?
– Nícolas Tarzia