Wrong message in webservice integrating with ActionScript

3

I'm doing a restful application in C #, in which I will receive a request via post and will return a JSON or a string for the requester.

[HttpPost]
    public string confirmahora()
    {         
        String OUTPUT = "mensagem";

        HttpConfiguration config = new HttpConfiguration();
        config.Formatters.Remove(config.Formatters.JsonFormatter);   

        return resposta;
    }

But when the Flash (ActionScript) application receives the following header:

<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">"mensagem"</string>

You should only see the word "message".

    
asked by anonymous 18.11.2014 / 13:39

1 answer

1

Before returning the response, make sure that the response header will return text/plain , like this:

[HttpPost]
public string confirmahora()
{         
    String OUTPUT = "mensagem";

    HttpConfiguration config = new HttpConfiguration();
    config.Formatters.Remove(config.Formatters.JsonFormatter);
    System.Web.HttpContext.Current.OutgoingResponse.ContentType = "text/plain";

    return resposta;
}
    
18.11.2014 / 19:49