public async Task <String> SaveImageData(Photo photo) { try { return(null); var fileName = Path.GetFileName(photo.ImagePath); var imageStream = _pictureManager.GetPictureStream(photo.ImagePath); byte[] byteArray = ReadFully(imageStream); string Url = "http://10.0.3.2:7793/api/values/"; var jsonObj = new JsonPhoto { Comment = photo.Comment, Data = byteArray, Name = fileName }; var jsonString = JsonConvert.SerializeObject(jsonObj); HttpClientHandler objch = new HttpClientHandler() { UseDefaultCredentials = true }; using (var client = new HttpClient(objch)) { client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); client.DefaultRequestHeaders.Add("API key", "Key"); var content = new StringContent(jsonString, Encoding.UTF8, "application/json"); using ( var message = await client.PostAsync(Url, content)) { var input = await message.Content.ReadAsStringAsync(); } } } catch (Exception ex) { Debug.WriteLine(ex.Message); } return(null); }