How to enable CORS in .NET Core or Framework when AQB service is on a different host/port than the webserver?
Last modified:
To enable CORS for Active Query Builder in a .NET Core project, add the following line as the first line to the Configure method in the Startup.cs file:
app.UseCors( b => b.AllowAnyHeader().AllowAnyMethod().AllowAnyOrigin() );
To enable CORS in a .NET Framework project, add the "Access-Control-Allow-Origin" header via the web.config file as follows:
<system.webServer>
...
<httpProtocol>
<customHeaders>
<clear />
<add name="Access-Control-Allow-Origin" value="*" />
</customHeaders>
</httpProtocol>
...
</system.webServer>