linkl的C#下载程序问题 [英] C# downloader problem at linkl
问题描述
我试图在c#wich崩溃中创建一个downlaoder,因为我不明白的错误。我从另一个网站获得了代码并完全复制它以试用它,但它对我不起作用。我的剧本:
I try to create a downlaoder in c# wich crashes because of an error i dont understand. i got the code from another site and copied it exactly to try it out but it doesnt work for me. my script:
private void button4_Click(object sender, EventArgs e)
{
progressBar.Visible = true;
WebClient webClient = new WebClient();
webClient.DownloadFile("http://www.spadille.net/aos075install.msi", @"C:\aos075install.msi");
webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(ProgressChanged);
webClient.DownloadFileCompleted += new AsyncCompletedEventHandler(Completed);
private void ProgressChanged(object sender, DownloadProgressChangedEventArgs e)
{
progressBar.Value = e.ProgressPercentage;
}
private void Completed(object sender, AsyncCompletedEventArgs e)
{
MessageBox.Show("Download Abgeschlossen!");
progressBar.Visible = false;
System.Diagnostics.Process.Start("\\aos075install.msi");
}
private void button5_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("\\Ace of Spades\\readme.txt");
}
}
原始链接:
http://www.csharp-examples.net/download-files/ [ ^ ]
感谢您的帮助!
很抱歉没有发布确切的错误,但是它用德语发布,所以它不会帮助大多数人,但如果我翻译它就像:未处理的WebException - 在Web提示要求期间出现异常错误。
the link to the original:
http://www.csharp-examples.net/download-files/[^]
thanks for help!
Sorry for not posting the exact error but its in german so it wont help most of you, but if i translate it it''s like: Unhandled WebException - Exceptional Error During a Web cleint demand.
推荐答案
webClient.DownloadFile(http://www.spadille.net/ aos075install.msi,@C:\ aos075install.msi);
确保此路径正确且文件实际存在存在于那条路上。
webClient.DownloadFile("http://www.spadille.net/aos075install.msi", @"C:\aos075install.msi");
Make sure this path is correct and a file actually exists at that path.
这篇关于linkl的C#下载程序问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!