Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi,

Scenario is:
a) webservice(Suppose Webservice.asmx) is hosted on one server, suppose www.xyz.com
b) On www.xyz.com domain, a javascript file is present who accesses this webservice.
c) On www.test.com , the javascript file of www.xyz.com is included in html page.
d) When i run html page of www.test.com site, i got following error :
" 500 internal server error(Check in browser console)."
e) When i include same javascript file in html page of www.xyz.com domain then it works fine.
f) Both applications are running on IIS6.0

I am using this code for cross domain web service call :

$.support.cors = true;
 
    $.ajax({
        type: 'POST',
        crossDomain: true,
        dataType: "jsonp",
        jsonpCallback: 'jsonCallback',
        contentType: "application/json; charset=utf-8",
        url: baseurl + "/HelloWorld",
        data: '{}',
        dataType: "json",
        success: function(data) {
            alert(data.d);
        },
        error: function(err) {
            alert(err.statusText);
        }
    });

I added this header entry in IIS6.0 : Access-Control-Allow-Origin" value="*"

When I run it, i get 500 internal server error(Check in browser console).

Can anyone please let me know how to solve cross domain webservice access issue.

Thanks in Advance.
Posted
Updated 10-Apr-13 5:50am
v2

I have faced that issue, I wanted to access a certain page on certain site but I got that similar error. It turns out that you cannot do a ajax call of link other other site. Browser does not allow.

I solved it by calling a page in the same server and from that page I made an HTTP connection with that HTTP page and echo the returned result as output. It served my purpose
 
Share this answer
 
v2
Check virtual directory for both services in IIS
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900