ASP MVC Core Cors Problem
- Aug 26, 2019
Nowadays the applications are at the backend and single-page applications are working like forklift between the client and the back-end. These applications are like Angular or React. This trend caused a headache called the CORS error.
To enable CORS on your ASP MVC Core project please visit the Configure section of the Startup.cs and add the below line.
app.UseCors(builder => builder.AllowAnyHeader().AllowAnyMethod().AllowAnyOrigin().AllowCredentials());
Normally using AllowAnyOrigin and AllowCredentials is not a best practice but it won’t create any obstacle on the way. You can edit it on your behalf.
Another Temporary Solution
You can press Win+R and run the Chrome browser without CORS patch activated.
chrome.exe --user-data-dir="C:/Chrome dev session" --disable-web-security