Error: Access to XMLHttpRequest at 'http://localhost:7078/websync.ashx?token=1&src=js&AspxAutoDetectCookieSupport=1' from origin 'http://localhost:4200' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The 'Access-Control-Allow-Origin' header contains multiple values 'http://localhost:4200, *', but only one is allowed.
Goal: Be able to send a variable from SiteA to SiteB.
(SiteB hosts an iframe that appears on SiteA. SiteA hosts the angular and asp.net webapi. SiteB is the chatserver)
These are the current settings. Do I need both the web.config and the global.asax.cs file? What specifically is causing the error above from my setup? It is my understanding that this happens when it's set in more than one place. Is having it in the web.config and the asax.cs causing that?
I've been through a lot of documentation about HttpResponse as well as CORS but feel like i'm missing a few pieces here:
SiteA\Web.config:
<add name="Access-Control-Allow-Origin" value="*" />
SiteA\Global.asax.cs:
response.AddHeader("Access-Control-Allow-Headers", "access-control-allow-origin,accept,x-api-applicationid,content-type,authorization");
SiteB\Web.config:
<add name="Access-Control-Allow-Origin" value="*" />