We have a definition in web.config to set Access-Control-Allow-Origin header for all requests to one predefined server. like this:
<customHeaders>
<add name="Access-Control-Allow-Origin"value="http://constantServer.com" />
<add name="Accept-Bytes" value="none" />
</customHeaders>
there are some cases we need to allow access to different server to a specific resource. we check the origin and set the Access-Control-Allow-Origin by code, like this:
Response.AddHeader("Access-Control-Allow-Origin", origin);
Response.AddHeader("Access-Control-Allow-Credentials", "true");
The problem is that the browser get multiple values for the Access-Control and its not allowed it.
We want to remove by code the header that was defined in the web.config in cases that we need to allow it for different origin.
I tried to remove it at the global.asax in the Application_PreSendRequestHeaders event, but i didnt find this header there.(its seems that this header is being added after this event)
Thanks