我有一个应用程序,前端是ASP.NET (VB.NET),后端是Oracle。在oracle中,我有一个在两个文件服务器(文件服务器A、文件服务器B)上生成文件的过程。我有两个服务器,一个是开发服务器,另一个是客户端服务器。在我的应用程序中,我有一个用于生成报告的网页'GenerateReport.aspx‘。后台程序根据日期在文件服务器A和B上生成文件,当我在开发服务器上托管应用程序并下载生成的文件时,它是完全下载的,而当我在客户端服务器上托管应用程序并不加载生成的文件时,只下载了文件的一部分( 97MB文件,56KB)。我用来下载文件的代码如下所示。
私有子DownloadFileClient(字符串形式的ByVal RemoteFilePath )
Try
Dim File As System.IO.FileInfo
File = New System.IO.FileInfo(RemoteFilePath)
If File.Exists Then
Response.Clear()
Response.AddHeader("Content-Disposition", "attachment; filename=" & File.Name)
Response.AddHeader("Content-Length", File.Length.ToString())
Response.ContentType = "application/octet-stream"
Response.TransmitFile(File.FullName)
Response.End()
Else
lblErrorMsg.Text = "Unable to Download"
End If
Catch ex As Exception
lblErrorMsg.Text = "Unable to Download,check file path"
End Try结束子对象
发布于 2010-08-09 23:04:03
在调用Response.End()之前刷新响应流。
实际上,除非您遗漏了其他东西,否则应该使用Flush(),但不必费心调用Response.End()。
https://stackoverflow.com/questions/3441302
复制相似问题