'下载指定文件 '参数信息: resp 页面输出流 引用变量 ' strfilename 文件名全路经(例:"d:\文件夹名\文件名.后缀名") Sub DownLoad(ByRef resp As HttpResponse, ByVal strFileName As String) Dim f As New System.IO.FileInfo(strFileName) resp.Clear() resp.AddHeader("Content-Disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode(System.Text.Encoding.UTF8.GetBytes(f.Name))) resp.AddHeader("Content-Length", f.Length.ToString()) resp.WriteFile(f.FullName) resp.End() End Sub
http://www.yesky.com/SoftChannel/72342380468109312/20040326/1781390.shtml
http://dev.csdn.net/develop/article/20/20849.shtm
???
'参数信息: resp 页面输出流 引用变量
' strfilename 文件名全路经(例:"d:\文件夹名\文件名.后缀名")
Sub DownLoad(ByRef resp As HttpResponse, ByVal strFileName As String)
Dim f As New System.IO.FileInfo(strFileName)
resp.Clear()
resp.AddHeader("Content-Disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode(System.Text.Encoding.UTF8.GetBytes(f.Name)))
resp.AddHeader("Content-Length", f.Length.ToString())
resp.WriteFile(f.FullName)
resp.End()
End Sub
exe,zip等这种IE就会自动下载了楼主是不是有什么特殊要求?!