0

I call AJAX request and the browser got CORS error. I tried to add "Access-Control-Allow-Origin" in IIS web.config. But it doesn't work. I have two servers. My AJAX is true only when I have this issue. So, how can I resolve it?

<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Methods" value="GET,PUT,POST,DELETE,OPTIONS" />
<add name="Access-Control-Allow-Headers" value="Content-Type" />
<add name="Access-Control-Allow-Credentials" value="true" />
3
  • 1
    Is this 2016 or 2019? It overrides CORS setting in code is the reason I ask.
    – user6024
    Oct 8, 2020 at 4:12
  • 1
    which endpoint you are trying to reach? please provide us with some code. Oct 8, 2020 at 10:17
  • I want to reach other asmx url. And we use Sharepoint 2016. I added the codes i write above in web.config. I added the same to ajax in frontend. But Nothing's changed . Also, i try Url Rewrite. I made rules in there. And this doesn't work for me.
    – f_gulay
    Oct 22, 2020 at 6:33

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.