vendredi 27 février 2015

How to download image using WebClient.UploadString method?

I want to get image by sending json data to API. I use WebClient to download image.



string URI = "http://my_api.com";
string myParameters = "{'my': 'json_object'}";

using (WebClient wc = new WebClient())
{
wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
string HtmlResult = wc.UploadString(URI, myParameters);
}


UploadString method's return type is string. How can I convert this result to ContentType: image/jpeg ?


Aucun commentaire:

Enregistrer un commentaire