我尝试使用以下代码下载一个简单的.txt文件:
WebClient webClient = new WebClient();
webClient.DownloadFileCompleted += new AsyncCompletedEventHandler(Completed);
webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(ProgressChanged);
webClient.DownloadFileAsync(new Uri("http://www.webscripts.atw.hu/a.txt"), @"c:\tmp\TEST01.txt");
由于某种原因,下载的文件包含网页的源代码,并且没有文本文件的内容。我不知道为什么会这样。任何人都可以帮助我吗?
答案 0 :(得分:0)
这链接到一个带有iframe的页面,其中包含文本文件。试试这个网址:http://users.atw.hu/webscripts/a.txt
您可以转到原始页面并查看页面来源。