Question:
I have an application that uses a Java script function and sends a call to consume a web service.
Everything works fine but nothing shows up in the browser.
When I see the console I get a message CORS header 'Access-Control-Allow-Origin' missing
I have tried searching in various places but I have no answer. Any ideas
The code is made in C # and aspx
Answer:
There is a site dedicated to providing CORS information for any technology. In your case, as you mention that you use ASP web services, I suppose that the information that will be useful to you is related to IIS7: http://enable-cors.org/server_iis7.html
Taking a quick look at it, you will have to modify your web.config (where your web services are) to include the following information.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>