I have a question about those 2 httpcontents.
I've made an webapi (php), copy from this: http://www.9lessons.info/2012/05/create-restful-services-api-in-php.html I re-used the Rest.inc.php, and implement my own api file.
I try to call this api from .Net (I'm a .Net developer) - a simple WinForm Application - the FormUrlEncodedContent works but the StringContent does not. This my code:
Dictionary<string, string> parameters = new Dictionary<string, string>();
parameters.Add("username", username);
parameters.Add("title", title);
parameters.Add("text", text);
var jsonString = JsonConvert.SerializeObject(parameters);
var content = new StringContent(jsonString, Encoding.UTF8, "text/json");
//var content = new FormUrlEncodedContent(parameters);
PostData(url, content);
And the reason why I want to use StringContent: in the real data, sometime the parameters will contain a byte[] (photo), and the FormUrlEncodedContent can't handle it
Please help me Thanks alot!