has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.

shanker bangari 0 Reputation points
2023-10-06T04:54:43.0766667+00:00

Hi,

Am getting following error

Access to XMLHttpRequest at 'https://stageapi.faida.org.in/api/Notification/WebInquiryCreate' from origin 'https://faida.org.in' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.

actually its working with local host but its not working with web site after deploy IIS

I have followed by this link

https://www.codeproject.com/Articles/1119206/How-to-Enable-Cross-Origin-Request-in-ASP-NET-Web

Thansk

Shanker.B

Windows development | Internet Information Services
Developer technologies | ASP.NET | Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Sam Wu-MSFT 7,561 Reputation points Microsoft External Staff
    2023-10-06T06:58:01.52+00:00

    @shanker bangari

    The article in the link mentions that you need to add the following code to the system.webServer part of web.config, please make sure you have added it, if it still doesn't work, you can use fiddler to get error details.

    <httpProtocol>
        <customHeaders>
          <add name="Access-Control-Allow-Origin" value="*" />
          <add name="Access-Control-Allow-Headers" value="Content-Type" />
          <add name="Access-Control-Allow-Methods" value="GET, POST, PUT, DELETE, OPTIONS" />
        </customHeaders>
    </httpProtocol>
    

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.