Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET Javascript Ajax jQuery , +
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 9-Apr-13 5:05am
Adi_1.9K
Edited 10-Apr-13 6:50am
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Check virtual directory for both services in IIS
  Permalink  

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



Advertise | Privacy | Mobile
Web03 | 2.8.1411022.1 | Last Updated 10 Apr 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100