Why do I get an OutOfMemoryException when I have images in my ListBox?

Oh, I recently killed whole day to make this working! So the solution is: Make your Image control free resources. So set the BitmapImage bitmapImage = image.Source as BitmapImage; bitmapImage.UriSource = null; image.Source = null; as it was mentioned before. Make sure you virtualize _bitmap on every item of the list. You should load it … Read more

How to upload file to server with HTTP POST multipart/form-data?

Basic implementation using MultipartFormDataContent :- HttpClient httpClient = new HttpClient(); MultipartFormDataContent form = new MultipartFormDataContent(); form.Add(new StringContent(username), “username”); form.Add(new StringContent(useremail), “email”); form.Add(new StringContent(password), “password”); form.Add(new ByteArrayContent(file_bytes, 0, file_bytes.Length), “profile_pic”, “hello1.jpg”); HttpResponseMessage response = await httpClient.PostAsync(“PostUrl”, form); response.EnsureSuccessStatusCode(); httpClient.Dispose(); string sd = response.Content.ReadAsStringAsync().Result;