How to enable cross origin requests in ASP.NET MVC [duplicate]

Add the configuration setting in your web.config file to set the value for Access-Control-Allow-Origin in customHeaders like this –

<configuration>
 <system.webServer>
   <httpProtocol>
     <customHeaders>
       <add name="Access-Control-Allow-Origin" value="*" />
     </customHeaders>
   </httpProtocol>
 </system.webServer>
</configuration>

You would like to visit this and this for more details and some other options.

Leave a Comment