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");
}
4

1 回答 1

0

你没有给它一个文件名。

client.DownloadFileAsync(new Uri(url),
           @"C:\Users\PC\Desktop\Medieval Silver Edition\Alexville.zip");
于 2013-04-02T17:01:53.187 回答