Let's say I want to call some server-side method and pass the following JSON object to it:
var t = { "test": 0};
I am using jQuery library $ .ajax method with the following parameters:
type: "POST", async: true, url: 'mypage.aspx?Action=myAction, data: { test: JSON.stringify(t, null, 2) }, contentType: 'application/x-www-form-urlencoded', dataType: 'json', . . .
On the server side, I retrieve the data using the following code:
public string GetInputStream() { string inputContent; using (var sr = new System.IO.StreamReader(Request.InputStream)) inputContent = sr.ReadToEnd(); return Server.UrlDecode(inputContent.Split('=')[1]); }
When called from browsers other than Mac Firefox version 3.6.12, the getinputstream method returns:
test=%7B%0A++%22test%22%3A+0%0A%7D
which is valid and then can be deserialized into an object, but when calling this method from Mac OS X 10.5.8 Firefox 3.6.12 I got a line that cannot be deserialized:
test=%7B%0A++%22test%22%3A0%0A%Pr
I believe that Pr at the end of the line confuses me and does not turn into a closing bracket. Any ideas?
EDIT: I looked at the Firebug Net> Call> POST tab and was surprised to see that the POST line is correct: test=%7B%0A++%22test%22%3A%220%22%0A%7D where else this POST line can be changed to get to the server with an invalid string?
EDIT2: An interesting search, all problems are resolved if HTTPS (secure) is used :-). I suppose this should be a security setting on Mac Firefox?