如何从Windows表单中的给定URL将文件下载到特定路径? [英] How to download a file to a specific path in from a given url in a windows form?

查看:52
本文介绍了如何从Windows表单中的给定URL将文件下载到特定路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用winforms从指定的链接(URL)将pdf文件下载到Windows应用程序中的特定文件夹,请任何人可以向我提出解决方案.

I need to download pdf files from a specified links(url) to a specific folder in a windows application using winforms please any one can suggest me with a solution.

推荐答案

using System.Net;

using (WebClient webClient = new WebClient())
{
    webClient.DownloadFile("http://mysite.com/myfile.txt", @"c:\myfile.txt");
}

这篇关于如何从Windows表单中的给定URL将文件下载到特定路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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