Web共享文件,隐藏文件路径方式下载
2012-02-28 09:25
288 查看
Private Sub SaveFile(ByVal reportNumber As String, ByVal logicFullFileName As String, ByVal reportType As String)
Dim fullFileName As String = Server.MapPath(logicFullFileName)
Dim downFile As FileInfo = New FileInfo(fullFileName)
If Not File.Exists(fullFileName) Then
Response.Write("The file not exist.")
Exit Sub
End If
Response.Clear()
Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(reportNumber & "." & reportType))
Response.AddHeader("Content-Length", downFile.Length.ToString())
Response.ContentType = "application/octet-stream"
Response.TransmitFile(fullFileName)
Response.End()
End Sub
Dim fullFileName As String = Server.MapPath(logicFullFileName)
Dim downFile As FileInfo = New FileInfo(fullFileName)
If Not File.Exists(fullFileName) Then
Response.Write("The file not exist.")
Exit Sub
End If
Response.Clear()
Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(reportNumber & "." & reportType))
Response.AddHeader("Content-Length", downFile.Length.ToString())
Response.ContentType = "application/octet-stream"
Response.TransmitFile(fullFileName)
Response.End()
End Sub
相关文章推荐
- 以流的方式下载文件,隐藏实际的下载路径
- 以流的方式下载文件,隐藏实际的下载路径
- 实现WEB与后台应用程序交互方式之共享文件
- jsp页面点击下载文件 java方式(服务器上带路径文件 以文件流输出)
- Windows Mobile Web方式下载文件
- PHP之FOPEN隐藏文件下载路径
- ASP和C#隐藏文件下载路径的方法
- ASP和C#隐藏文件下载路径的方法
- 关于项目以war包方式部署,文件下载找不到路径
- web文件下载、真实路径问题
- web 方式访问 Domino 服务器,无法下载文件名包含百分号的文件
- WebRequest 方式 文件下载
- 打开ASP.NET Web项目时,此项目的默认Web访问模式设置为文件共享, 但是无法从路径“...”打开“...”处的项目文件夹。返回的错误是: 无法打开Web项目“”。返回的错误是: 无法打开Web项目“...”。文件路径“...”怀URL“...”不
- JAVA_WEB项目中响应端获取文件路径的方式(tomcat服务器)
- 读取Properties配置文件, 四种方式都可以得到webroot/WEB-INF/classes这个路径
- 借道IIS搭建企业内部Web方式文件共享平台
- ASP和C#隐藏文件下载路径的方法
- 点击按钮直接下载文件(隐藏文件路径)
- java web上传文件至非项目路径并配置tomcat虚拟路径进行下载
- Windows Mobile Web方式下载文件