Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

CORS requests

$
0
0

I have following code

 services.AddCors(options => options.AddPolicy("AllowAll", p => p.AllowAnyOrigin()
                                                                           .AllowAnyMethod()
                                                                           .WithHeaders("accept", "origin", "user-agent")));

but my requests are rejected:

XMLHttpRequest cannot load http://localhost:25526/product/GetProducts?listingTypeId=1&page=0&pageSize=10. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8100' is therefore not allowed access.

I can see through browser that the three headers are included in the request.

Does anyone knows why?

Thanks in advance


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>