我正在處理我的項目。我需要在沒有參數的情況下使用Webclient傳遞URL。使用webclient調用不帶參數的網址
WebClient webClient = new WebClient();
webClient.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
var uri = new Uri("http://misteducation.org/getques.php/testlist", UriKind.Absolute);
webClient.UploadStringCompleted += new UploadStringCompletedEventHandler(webClient_UploadStringCompleted);
webClient.UploadProgressChanged += webClient_UploadProgressChanged;
webClient.UploadStringAsync(uri,"POST",string.Empty);
我正在使用此代碼,但我收到一個異常。
什麼例外?在哪一行? –
我addded string.Empty因爲。不需要參數。 – rozy
這裏我得到錯誤:void webClient_DownloadStringCompleted(object sender,DownloadStringCompletedEventArgs e) { string jsonstring = e.Result; } – rozy