0
我要求以下文件在C#中下載,並且對話框顯示說文件已下載,所以當我去檢查文件夾,該文件沒有下載!代碼要求文件被下載+對話框,但只有對話框顯示
private void Button_Click_1(object sender, RoutedEventArgs e) {
string url = @"http://dc451.4shared.com/download/eWW2ICvX/Alexville.zip?tsid=20130402-163358-7222b14a";
// Create an instance of WebClient
System.Net.WebClient client = new System.Net.WebClient();
// Hookup DownloadFileCompleted Event
client.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadFileCompleted);
// Start the download and copy the file to c:\temp
client.DownloadFileAsync(new Uri(url), @"C:\Users\PC\Desktop\Medieval Silver Edition");
}
void client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e) {
MessageBox.Show("File downloaded");
}
你試過了嗎?它不能正常工作 – Shaharyar
我將其更改爲MedievalSilverPC.zip,並且出現以下錯誤'名稱'MedievalSilverPC'在當前方法中不存在。'# –
@Shaharyar - 我還沒有嘗試下載文件本身。是否有錯誤訊息? – keyboardP