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

UploadStringTaskAsync() public method

public UploadStringTaskAsync ( System address, string data ) : System.Threading.Tasks.Task
address System
data string
return System.Threading.Tasks.Task
        public System.Threading.Tasks.Task<string> UploadStringTaskAsync(System.Uri address, string data) { throw null; }
        public System.Threading.Tasks.Task<string> UploadStringTaskAsync(string address, string method, string data) { throw null; }

Same methods

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

Usage Example

        public async void Register(UtsData data)
        {
            string json = JsonConvert.SerializeObject(data);
   
            Log.Info("Register", json);

           // Request Address of the API    
            string url = Server.url + "api/student/register";

           String result = null;
        
               using (WebClient wc = new WebClient())
               {
                
                wc.Headers[HttpRequestHeader.ContentType] = "application/json; charset=utf-8";
                wc.Headers.Add("AppKey", "66666");


                result = await wc.UploadStringTaskAsync(new Uri(url), json);
                   

                Log.Info("Register SUCCESS", result);
                HomeController loginController = new HomeController();
                await loginController.login(data.StudentId);

            }

              

        }
All Usage Examples Of System.Net.WebClient::UploadStringTaskAsync