I am using ASP.NET framework with Angular 18. I am trying to delete a row but whenever I try to delete, I get this error:
Response to preflight request doesn’t pass access control check: It does not have HTTP ok status
I had tried all the ways to enable Cors or to use proxy.config.json
file – but nothing worked.
Fyi the project gets the data normally but the problem appears in delete
I have tried all possible ways in the backend; I tried to enable Cors in my web.config
and global.asax
In Angular I tried proxy file
2
Answers
In CORS mechanism , the browser makes an "Option" called request "preflight" to your method ,if the response will "200- OK" the the browser continues with the main request if it fails , then the CORS error will be raised.
So in your case there might be an exception in your action that makes the preflight request fail. you can also use postman to make your request and trace it from the beginning of request pipeline to spot the problem .
try
And call it from angular as