Fix Error Access Blocked by CORS Policy in ASP.NET Web API (.NET 7) | Cross-Origin Request Blocked



Fix Error Access Blocked by CORS Policy in ASP.NET Web API (.NET 7) | Cross-Origin Request Blocked

Fix Error Access Blocked by CORS Policy in ASP.NET Web API (.NET 7) | Cross-Origin Request Blocked

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://localhost:7209/WeatherForecast. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 200.
Access to fetch at ‘https://localhost:7209/WeatherForecast’ from origin ‘null’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled
#######################

*Full ASP.NET Web API Course on Udemy* : https://www.udemy.com/course/build-aspnet-web-api/?couponCode=201005559FCD3B485A0F
*Full ASP.NET Web App with Razor Pages Course on Udemy* : https://www.udemy.com/course/aspnet-core-web-application-using-razor-pages/?couponCode=1020144B06D6D641661C

#######################
*Source code in the first comment*

Comments are closed.