Set the response type to either XML or JSON.
This sets the Content-Type in the http header so that the response will be returned in either XML or JSON format.
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");
}
}