When working with a WEB API if you want to share resources between different domains we need to enable CORS in Program.cs as shown below.
app.UseCors(builder => builder
.AllowAnyHeader()
.AllowAnyMethod()
.AllowAnyOrigin()
);
Note that it is recommended to have this after
app.UseRouting(); middleware.
Cheers,
Samitha
No comments:
Post a Comment