downloadFile与"保存为" [英] downloadFile with "save as"

查看:106
本文介绍了downloadFile与"保存为"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要写一个过程,在我的vb.net web应用程序在本地下载一个HTML文件。我目前使用 webClient.DownloadFile

I need to write a process to download an html file locally in my vb.net web app. I am currently using webClient.DownloadFile :

Dim myWebClient As New System.Net.WebClient
myWebClient.DownloadFile("http://archive.ncsa.illinois.edu/primer.html", _
                        "C:\test.html")

是否有一个内置的方式做到这一点与另存为窗口代替,以使用户可以选择他们希望被保存到该文件的位置?或者,我需要写我自己?

Is there a built-in way to do this with a "save as" window instead, so that the user can select the location they would like the file to be saved to? Or would I need to write my own?

推荐答案

您可以使用

Response.AddHeader("Content-Disposition", "attachment;filename=testfile_file.html");
Response.Write or Response.WriteFile

这篇关于downloadFile与"保存为"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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