I have a web api net 6 published on a web hosting service (interserver), everithing works ok on all api methods, except on PUT and DELETE.
I configured Cors on Program.cs
app.UseCors(options =>
{
options.AllowAnyOrigin();
options.AllowAnyMethod();
options.AllowAnyHeader();
options.AllowCredentials();
});
also I tried the recommended method of
var myAllowSpecificOrigins = "_myAllowSpecificOrigins";
options.AddPolicy(myAllowSpecificOrigins, policy =>
{
//policy.AllowAnyOrigin();
policy.WithOrigins("http://localhost:52039", "https://www.-----.com")
.AllowAnyMethod()
.AllowAnyHeader();
});
app.UseCors(myAllowSpecificOrigins);
and same result, all GETs and POSTs works fine, all PUT and DELETE get a CORS error and 403 error (forbidden).
I've tried everything combining this methods and adding to the controllers [EnableCors(...)]
Nothing works
Can someone help me?
I am new to net 6.
Thanks in advance