I just updated a test copy of my site to asp.net 4.0 and noticed a strange problem that only occurs when I upload the site to my server.
the site has an asmx web service that returns json, but when I start the site on my server, it returns xml. It has been working fine in asp.net 3.5 for over a year.
webMethod is decorated with the right attributes ...
[WebMethod][ScriptMethod(ResponseFormat = ResponseFormat.Json)] public List<LocationRecentChange> RecentChanges()
and on my local machine it returns json.
still on the server (Windows 2008 64bit) it returns xml.
using the firebug console, you will see a 200 OK response and a bunch of XML, and on my local machine, the returned data is the expected JSON.
Here is the javascript that calls the service.
function loadRecentData() { $.ajax({ type: "POST", url: "service/spots.asmx/RecentChanges", data: "{}", contentType: "application/json; charset=utf-8", dataType: "json", success: loadRecentUpdates, failure: function(msg) {
}
Any suggestions are welcome, it puzzled me!
Baldy May 01 '10 at 12:45 2010-05-01 12:45
source share