0

I'm using firefox to perform a connection between an AngularJS/HTML client page and a controller on the ASP.NET WebAPI.

The issue is that I keep getting the "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://localhost:44377/project/all. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing)." unless I enable the CORS firefox extension.

Even with that enabled, my page doesn't seem to be grabbing the required data; but the errors are gone.

[EnableCors(origins: "https://localhost:PortNumberHereWithoutTheForwardSlah", headers: "", methods: "")] above my Controller:ApiController and used the config.EnableCors(); in the WebApi.Config in App_Start.

Note: the method that uses [HttpGet] does work when I try to use it in my browser.

user199135
  • 23
  • 7
  • 1
    Does this answer your question? [How to fix "The CORS protocol does not allow specifying a wildcard (any) origin and credentials at the same time" error](https://stackoverflow.com/questions/53675850/how-to-fix-the-cors-protocol-does-not-allow-specifying-a-wildcard-any-origin) – Rafael Herscovici Nov 20 '21 at 22:24
  • No, I'm on ASP.net MVC – user199135 Nov 20 '21 at 23:33
  • https://stackoverflow.com/questions/40079214/how-to-enable-cross-origin-requests-in-asp-net-mvc – Rafael Herscovici Nov 22 '21 at 11:12

1 Answers1

1

</system.webServer> Thanks, but I found inserting this between /handlers and /system.webServer in Web.config to be more flexible from another post.

user199135
  • 23
  • 7
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Nov 22 '21 at 23:14