Posts tagged ‘Web Service’

Enable Cross-domain Ajax requests using web.config

Error : 

XMLHttpRequest cannot load webservice.asmx. No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

Solution : 

Add Below code in web.config file.

<system.webServer>

<httpProtocol>

<customHeaders>
<!–Allow Web API to be called from a different domain.–>

<add name=”Access-Control-Allow-Origin” value=”*” />

</customHeaders>

</httpProtocol>

</system.webServer>

Advertisements