Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

This question has probably been answered before but I haven't been able to find a suitable answer.

I'm using asp.net web forms and am wanting to make a jquery Ajax request from one site on a particular domain to another site on another domain. The Ajax request is to a web method on an aspx page.

As expected I am having problems with CORS. My question is are you able to make an Ajax call to a web method on an aspx page from a different domain? If so any advice or links to resources would be very grateful.

Thanks David

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
208 views
Welcome To Ask or Share your Answers For Others

1 Answer

You've got several options. First, you can use CORS (http://enable-cors.org/) but only if you've got access to the application on the target server.

Alternatively, you can use JSONP (but again, the server must support it): http://www.sitepoint.com/jsonp-examples/.

The last thing that comes into my mind would be using your server as a proxy: call a web service on your server which calls the remote server. This should work as server-to-server communication is not restricted by same origin policy (it's a browser feature).

Also, take a look at this thread: How to make cross domain request


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...