Мне нужно отправить изображение (jpeg, png и т. Д.) На сервер с параметрами access_token и photo (изображение, которое мне нужно отправить)
public void get_data(string url,Action<string> qw) {
try {
var request = (HttpWebRequest)WebRequest.Create(
new Uri(url));
request.BeginGetResponse(r => {
var httpRequest = (HttpWebRequest)r.AsyncState;
var httpResponse = (HttpWebResponse)httpRequest.EndGetResponse(r);
HttpStatusCode st = httpResponse.StatusCode;
if (st == HttpStatusCode.NotFound) {
ToastPrompt toast = new ToastPrompt();
toast.TextOrientation = System.Windows.Controls.Orientation.Vertical;
toast.Message = "Ошибка соединения с сервером";
toast.MillisecondsUntilHidden = 2000;
toast.Show();
} else
using (var reader = new StreamReader(httpResponse.GetResponseStream())) {
var response = reader.ReadToEnd();
Deployment.Current.Dispatcher.BeginInvoke(new Action(() => {
qw(response);
}));
}
}, request);
} catch (WebException e) { }
}