I have same problem like this . But when I try this code :
var json = (new MyResponse { message = "The user name or password is incorrect" }).ToJsonString();
context.SetError(new string(' ',json.Length-12));
context.Response.Write(json);
-
public class MyResponse
{
public string access_token { get; set; }
public string message { get; set; }
}
I get "syntax error". Because text response is:
{"access_token":null,"message":"The user name or password is incorrect"}{"error":" "}
I can't remove {"error":" "}