views:

52

answers:

1

Hi all,

I'm stuck on a clients host that has medium trust setup which blocks cross domain requests and need data from a 3rd party domain. I now have the option to use JSONP.

I've used JSONP from the client with jQuery to get around the browsers cross domain security and I've used HttpWebRequest in ASP.Net 3.5.

Is it possible to use JSON on the server and if so how?

I don't think it is, but worth asking seeing as I already have this app written server side....

Thanks, Denis

+1  A: 

The easy way might be just to proxy the JSONP request through your server. If that isn't an option (because the data must be processed in some way on the server) you can manually strip off the function-call from the return and then JSON-parse the rest

So if the JSONP call returns:

F001( { "moose" : "sister" } )

First, erase everything up to the first parenthesis and after the last so you have

{ "moose" : "sister" }

And parse that into whatever you need.

Malvolio