DISQUS

The Freak Parade: Simple ASP.NET MVC Ajax Proxy

  • chris patterson · 3 months ago
    Nice.

    When does a method like this need to be implemented versus taking advantage of something like JSONP?
  • nstults · 3 months ago
    My understanding of JSONP is that the script that wants to access remote data (which is expected to be javascript, I presume, whereas in this example the payload is a binary (png) stream) needs to be aware of the JSONP arrangement, whereas in this case the goal is allow a third party component (OpenLayers) interact with a map server on a different domain without having to write and specific client side or server side glue code to make it happen, we can just give the OpenLayers control a url to a WMS server and everything works as expected. Also with JSONP (as I understand it) the cross-domain resource needs to be aware of the protocol, whereas with a proxy, the cross-domain resource does not need any modification whatsoever. But I only briefly looked at JSONP at your mention, so I have a very light understanding of its capabilities.
  • chris · 3 months ago
    I did some research after reading your post. You are correct. The resource on the other end of the XSS call needs to be aware of the JSONP arrangement. It must "pad" the response with the call to the callback function. Rick Strahl has a good write up on the subject.

    http://www.west-wind.com/Weblog/posts/107136.aspx