I have an application having front end in ASP.NET (VB.NET) and at back end is of Oracle. In oracle i have a procedure which generates files on two file servers (File Server A, File Server B). I have two server one is development server and the other one is client server. In my application i have a web page ‘GenerateReport.aspx’ which is used to generate report. On the basis of dates the backend procedure generate file on the File Server A and B. when i host the application on development server and download the generated file it is downloaded completely and when i host the application of client server and donwload the generated files only a part of file is downloaded (56KB of 97MB file). Code i use to download file is given below.
Private Sub DownloadFileClient(ByVal RemoteFilePath As String)
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
End Sub
Flush the response stream before you call
Response.End().Actually, unless there’s other stuff you left out, you should Flush(), but don’t bother calling
Response.End().