C#C
C#3y ago
abc

❔ CORS error

I have enabled cors according to: https://learn.microsoft.com/en-us/aspnet/core/security/cors?view=aspnetcore-7.0
named policy and middleware

policy.WithOrigins("http://localhost:7022").AllowAnyHeader().AllowAnyMethod();

i still get

rom origin 'https://localhost:7022' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: 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.
Learn how CORS as a standard for allowing or rejecting cross-origin requests in an ASP.NET Core app.
Was this page helpful?