The 'Access-Control-Allow-Origin' header contains multiple values , but only one is allowed

The 'Access-Control-Allow-Origin' header contains multiple values , but only one is allowed



I got the above error when i call .net core api from backbone js
Here is my code



in start up.cs:


services.AddCors(options =>

options.AddPolicy("CorsPolicy",
builder => builder.AllowAnyOrigin()
.AllowAnyMethod()
.AllowAnyHeader()
.AllowCredentials());
);



in Configure i do the following:-


app.UseCors("CorsPolicy");
app.UseStaticFiles();
ConfigureAuth(app);
app.UseMvc();



Thanks in advance





i try to removing ALL code that enabled CORS and then added the cors settings to the system.webServer node of my Web.Config but issue still exists
– isree
Aug 30 at 12:17






I think when you use .AllowCredentials(), you need to specify domains, can't use .AllowAnyOrigin(). I'm removing backbone because it doesn't have anything to do with the problem, it's a backend issue
– T J
Sep 1 at 13:21



.AllowCredentials()


.AllowAnyOrigin()





i fixed the issue. remove header from iis http response headers
– isree
Oct 16 at 13:50






Required, but never shown



Required, but never shown






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)