System.Net.WebClient.UploadValuesTaskAsync C# (CSharp) Method

UploadValuesTaskAsync() public method

public UploadValuesTaskAsync ( System address, System data ) : System.Threading.Tasks.Task
address System
data System
return System.Threading.Tasks.Task
        public System.Threading.Tasks.Task<byte[]> UploadValuesTaskAsync(System.Uri address, System.Collections.Specialized.NameValueCollection data) { throw null; }
        public System.Threading.Tasks.Task<byte[]> UploadValuesTaskAsync(System.Uri address, string method, System.Collections.Specialized.NameValueCollection data) { throw null; }

Same methods

WebClient::UploadValuesTaskAsync ( System address, string method, System data ) : System.Threading.Tasks.Task
WebClient::UploadValuesTaskAsync ( string address, System data ) : System.Threading.Tasks.Task
WebClient::UploadValuesTaskAsync ( string address, string method, System data ) : System.Threading.Tasks.Task

Usage Example

 private async void HandleYesClicked(object sender, EventArgs e)
 {
     ButtonState(false);
     _collectedData["custommessage"] = tbCustomMessage.Text;
     UpdateStatus(Color.Blue, "Submitting...");
     using (var client = new WebClient())
     {
         try
         {
             byte[] response = await client.UploadValuesTaskAsync(ReportBugEndpoint, "POST", _collectedData);
             string responseStr = Encoding.ASCII.GetString(response);
             if (responseStr.Equals("ok"))
             {
                 UpdateStatus(Color.Green, "Submitted, thank you!");
             }
             else
             {
                 UpdateStatus(Color.Red, "Server error: " + responseStr);
                 ButtonState(true);
             }
         }
         catch (Exception uploadex)
         {
             UpdateStatus(Color.Red, "Failed to submit: " + uploadex.Message);
             ButtonState(true);
         }
     }
 }
All Usage Examples Of System.Net.WebClient::UploadValuesTaskAsync