Saturday, December 15, 2012

Returning Plain text from WCF service

Usually WebGet/Web Post will return data as JSON or Xml

 

In some cases, we may have to return a plain text or our own formatted text.

 

To do this, you can use the following steps,

 

1. Change the return type of the Method to Message instead of string

2. Return the text using by invoking WebOperationContext.Current.CreateTextResponse method

No comments:

Post a Comment