rikket
rikket

Reputation: 2407

CORS No 'Access-Control-Allow-Origin' header is present on the requested resource

I am getting the following error:

XMLHttpRequest cannot load http://localhost:62574/ServiceClass.asmx?op=loadMarkersViaWebService. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:15540' is therefore not allowed access. 

so I added the following in the Web.Config, however error still persists:

<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules runAllManagedModulesForAllRequests="true"/>
<httpProtocol>
  <customHeaders>
    <add name="Access-Control-Allow-Origin" value="http://localhost:15540/"/>
  </customHeaders>
</httpProtocol>

Upvotes: 0

Views: 4774

Answers (1)

user1448816
user1448816

Reputation:

Try Using This..

<httpProtocol>
 <customHeaders>
   <add name="Access-Control-Allow-Origin" value="*" />
   <add name="Access-Control-Allow-Headers" value="Content-Type, Accept" />
 </customHeaders>
</httpProtocol>

Upvotes: 3

Related Questions