I have a DataServiceContext querying my WCF Data Service:
service = new DataServiceContext(new Uri(SvcUrl));
service.SendingRequest += new EventHandler<SendingRequestEventArgs>
(OnSendingRequest);
I want to set the Accept header so that I get the result as json:
static void OnSendingRequest(object sender, SendingRequestEventArgs e)
{
e.RequestHeaders.Set("Accept", "json/text");
}
But I get an exception:
"This header must be modified using the appropriate property or method. Parameter name: name"
I cannot seem to figure out how else to set the Accept header.