App中通过http下载文件

App中通过http下载文件

本文介绍了在C#Windows App中通过http下载文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用C#Visual Studio 2010 .Net 4开发一个Windows应用程序。我的任务之一是在提交URL时将文件下载到我的本地文件夹。问题是给定的HTTP URL中没有文件名。该文件是动态生成的,它显示另存为对话框,在那里我可以看到文件名。



这是系统托盘应用程序,可在自动驾驶的基础上运行,无任何用户干扰。因此,我需要完成下载文件的任务不知道它的名字:(



希望我的问题现在清楚了!!!

I am developing an windows application using C# Visual Studio 2010 .Net 4. In which one of my task is to download a file to my local folder on submitting an URL. The problem is the given HTTP URL doesn't have a file name in it. The file is generated dynamically and it shows "Save As" dialog box, where I could see the file name.

This is system tray application and runs on auto pilot basis without any user interference. Hence, I need to achieve the task of downloading the file "without knowing its name" :(

Hope my question is clear now !!!

推荐答案


HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://dropshipdirect.com/warehouse/vendor_export_speedup.php?use_link=on&ve_sid=fal9vgtv5hg3yo4ofhiqhiuogmy3dbji");
WebResponse response = request.GetResponse();
string containsfilename = response.Headers[1];



这篇关于在C#Windows App中通过http下载文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 17:21