title: Access to XMLHttpRequest at '' from origin '' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested
body: <p>I have developed Asp.Net Core 3.1 API and deployed on the server through IIS, it's working as expected if I send the GET/POST request from Postman or browser, But Below code is giving error.</p>
  <pre><code>$.ajax({
     type: 'GET',
     crossDomain: true,
     dataType: 'json',
     url: 'myUrl',
     success: function(jsondata){
     }
  })
  </code></pre>
  <p><strong>Error:</strong></p>
  <blockquote>
  <p>Access to XMLHttpRequest at
  'http://server:8080/API/GetMethod?currency=INR'
  from origin 'http://localhost:63765' has been blocked by CORS policy:
  No 'Access-Control-Allow-Origin' header is present on the requested
  resource.</p>
  </blockquote>
  <p>I have disabled the CORS from my application using the below code
  <strong>C# code:</strong></p>
  <pre><code>[DisableCors]
  [Route(&quot;[controller]&quot;)]
  [ApiController]
  [AllowAnonymous]
  public class APIController : ControllerBase
  {
  </code></pre>
  <p>startup.cs</p>
  <pre><code>public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
  {
  loggerFactory.AddLog4Net();
  
  if (env.IsDevelopment())
  {
      app.UseDeveloperExceptionPage();
  }
  
          
  
  app.UseHttpsRedirection();
  
  app.UseRouting();
  
  app.UseCors();
  
  app.UseAuthorization();
  </code></pre>
  <p>So I have tried disabling the CORS on controller level, I have tried <code>jsonp</code> also instead of <code>JSON</code>, It's still getting the same error.</p>
  <p>I have two questions here.</p>
  <ol>
  <li>Is this clientside or serverside issue?</li>
  <li>How to fix the error?</li>
  </ol>
  <p><strong>Note:</strong> I able to send GET requests from browser and Postman, but with this clientside code, I am getting the CORS related issue.</p>