Return raw string from REST service method

14,446

Return it as a Stream - that causes the "raw" mode to be used and WCF will not touch your response. You can find more information at http://blogs.msdn.com/b/carlosfigueira/archive/2008/04/17/wcf-raw-programming-model-web.aspx.

Share:
14,446
bzamfir
Author by

bzamfir

Updated on June 04, 2022

Comments

  • bzamfir
    bzamfir almost 2 years

    I have a REST service method written in C#, defined as below:

    [WebGet(UriTemplate = "/{par1}/{par2}/{par3}")]
    public string ProcessGet(string par1, string par2, string par3)
    {
        return Execute(...);
    }
    

    It should return result as XML or JSON, based on one parameter (I generate the json and XML serialization)

    How can I make this method to return the RAW string, just as I created it, without HTMLEncoding it?

    Thank you