Wednesday, March 21, 2012

xmlhttp and outside servers.

I'm sure this is some kind of security feature but I'm hoping there is a fix or work around.

I have a page that is doing a xmlhttp GET to an outside server to get some data back. This works 100% when I am in debug mode in vs2008. Soon as I move the application to 1 of 2 hosting sites, it no longer works. I just get "access denied"

Why does this work just fine locally but not else where? Is there a way to around this some how?

For cross server requests, you'll need to either have an external service that supports JSONP (which is honestly kind of a pain to deal with) or create a proxy service on your local server that acts as a middle man.


but why does it work on my local server, which is a basic IIS setup and not on another server?


Different browser security settings for that local server probably.


:(

Guess I'm out of luck. I'll just run the part that needs to do the request from my local machine and everything else from the hosting.

Unless anyone has any tricks up their sleeve that can make this work :)

Thanks again ASP.Net forum people


You're not out of luck.

You just need to create a web service proxy that's running on your local domain. Basically an asmx in your solution that basically does no more than call the remote service and then return that result. So, your client side functionality can call the remote service by calling the local one, and there are no cross domain issues.

No comments:

Post a Comment