Method SetResponseType

Summary

Set the response type to either XML or JSON.

Remarks

This sets the Content-Type in the http header so that the response will be returned in either XML or JSON format.

Sample Responses

Sample Code

using System.Net;
static class Common
{

  public static void SetResponseType(WebClient wc, string type)
  {
      if (type.ToLower().Contains("xml"))
          wc.Headers.Add("Content-Type", "text/xml");
      else
          wc.Headers.Add("Content-Type", "application/json");
  }
}