The simplest way I’ve solved this is by adding below headers to all responses by adding them to Web.Config.
Just to state the obvious, when the client application and the server are both on localhost, the CORS issue doesn’t come into the pitcure.
Web.Config
But this doesn’t respond appropriately to the OPTIONS request that most modern browsers send the server before making API calls to see if it can actually make API calls.
The server sends an empty response with the above headers set with the following code in Global.asax.cs: