以编程方式下载文件-webClient问题? [英] Download file programmatically - webClient issue?

查看:90
本文介绍了以编程方式下载文件-webClient问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将我的申请指向"
http://www.nytimes.com/2011/05/24/technology/24sony.html?_r = 1 [ ^ ]

测试pdf下载.我总是遇到错误

I''ve "pointed" my application to
http://www.nytimes.com/2011/05/24/technology/24sony.html?_r=1[^]

to test the pdf download. I was getting always an error with

webClient.DownloadFile("http://www.sony.net/SonyInfo/IR/financial/fr/10revision_sony.pdf", "ficheiro.pdf");



我已经复制粘贴了该URL,只是为了确定,然后发现是否尝试了其他未发生的链接,例如



I''ve copy-pasted the URL just to make sure and then I discovered if I try it other links that dont happen, e.g,

webClient.DownloadFile("http://www.di.ubi.pt/~ddg/aulas/licenciatura/dwdm/dw/ch1s.pdf", "ficheiro.pdf");





It''s a kind of protected mode of the web server or something?

推荐答案

为什么使用Web客户端?

我已经开发了名为 HttpDownloader 的应用程序,并在此处共享其完整源代码:
如何从Internet下载文件 [ ^ ].

您可以查阅此源代码以了解如何正确执行.它使您可以继续中断的下载,这非常重要.很长一段时间对我都很好我没见过任何问题.

在开发自己的代码之前,可以在我的程序上测试URL,以确保它们确实可以用于测试代码.

享受,
—SA
Why Web client?

I''ve developed the application called HttpDownloader and shared its full source code here:
how to download a file from internet[^].

You can consult this source code to see how to do it right. It let you to continue the interrupted downloads, which is very important. It served me very well for a long time; I never saw any problems.

Before you develop your own code you can test your URLs on my program to make sure they can really be uses to test your code.

Enjoy,
—SA


这篇关于以编程方式下载文件-webClient问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆