从任何给定的URL下载文件并将其保存到我的机器上使用ASP.NET [英] Download a file from any given URL and save it to my Machine with ASP.NET

查看:109
本文介绍了从任何给定的URL下载文件并将其保存到我的机器上使用ASP.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

案例:我需要从互联网上的任何位置养活我的应用程序的URL。在URL的另一端将是某些种类的文件。照片/视频/文件,我需要这个项目自动保存到我的服务器,而另存为对话框。

Case: I need to feed my application a URL from any location on the internet. At the other end of the URL will be a file of some sorts. A picture/video/document and I need to save this item to my server automatically without a 'save-as' dialog box.

这需要在ASP.NET工作要做。

This needs to be done in ASP.NET.

有关于如何真正抓住用asp.net该文件喂养它的URL后麻烦林...任何帮助将是巨大的!

Im having trouble on how to actually grab that file with asp.net after feeding it a URL... Any help would be great!

感谢所有

推荐答案

您可以使用Web客户端或HttpWebRequest的。 Web客户端是你想做的事可能更容易。

You can use webclient or httpwebrequest. Webclient is probably easier for what you want to do.

WebClient wc = new WebClient();

wc.DownloadFile(downloadURL.Text, savePath.Text);

这篇关于从任何给定的URL下载文件并将其保存到我的机器上使用ASP.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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