[Mono-osx] JSON from [WebMethod] differs between Mac and Linux

jmalcolm malcolm.justin at gmail.com
Mon Feb 1 18:47:55 EST 2010


I have an ASP.NET app that was developed primarily in C# on Mono on Linux. 
It uses JQuery on the client side.  I have a few methods tagged with the
[WebMethod] attribute in my .aspx pages which generate JSON in response to
.ajax requests from JQuery.

When I serve this application from Apache/mod_mono or XSP on Linux, the JSON
that comes back is wrapped in a 'd' object that is added by the framework.

If I serve this app from XSP on OSX, the JSON comes back without the 'd'
wrapper.  This breaks the client-side code.

Is this an intentional difference between OSX and Linux?  Can I configure
this behavior somehow?

My understanding is that Microsoft added the 'd' wrapper in .NET 3.5 to
prevent certain kinds of cross site scripting attacks.  I am not sure when
it was added to Mono but I cannot remember it not being there on either
Linux or Windows.

I am using Mono 2.4.3.1 on Linux, Mono 2.4.3 on Windows, and Mono 2.6.1 on
OSX.

Here is a more concrete example of what I am saying:

JSON from Linux:

{"d":{"City":"Seattle","State":"WA"}}

JSON from OSX:

{"City":"Seattle","State":"WA"}
-- 
View this message in context: http://old.nabble.com/JSON-from--WebMethod--differs-between-Mac-and-Linux-tp27413475p27413475.html
Sent from the Mono - OSX mailing list archive at Nabble.com.



More information about the Mono-osx mailing list