Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > How to download large (400MB +) files from an asp.net page???

Reply
Thread Tools

How to download large (400MB +) files from an asp.net page???

 
 
Thomas Andersson
Guest
Posts: n/a
 
      07-12-2005
Hi,

I am trying to find a working solution for download of large files (400-800
MB)...
But this seems almost impossible to find a working example.

I have tried Response.Transmitfile, this works for some people…but in my
case the server reset the connection after approx. 20 minutes and sometimes
after
7-8 minutes…the download speed is however very good 400MB takes about 10
minutes to download.

I have also tried the code below, this solution also resets the connection
after 4-5 MB…and the download goes very slow approx. 55 kb/s…

Please does anyone have any ideas or proposals?
Is it possible to download via FTP?
Is it possible to use resume of broken downloads somehow?
Are there any components on the market that can achieve this?

'Download the selected file

Response.Buffer = False
Server.ScriptTimeout = 100
Dim FullPath As String = Server.MapPath(currentPath + StrFileName)
Dim DownloadFileInfo As New FileInfo(FullPath)
Dim Name = DownloadFileInfo.Name
Dim Ext = DownloadFileInfo.Extension
Dim stream = New System.IO.FileStream(FullPath, System.IO.FileMode.Open,
System.IO.FileAccess.Read, System.IO.FileShare.Read)
Dim StrFileType As String = ""
If Not IsDBNull(Ext) Then
Ext = LCase(Ext)
End If
Select Case Ext
Case ".exe"
'Exe file
StrFileType = "application/octet-stream"
Case ".zip"
'Zip file
StrFileType = "application/x-zip-compressed"
Case ".pdf"
'Pdf file
StrFileType = "application/pdf"
Case ".doc"
'MS Word
StrFileType = "Application/msword"
Case ".dll"
'Dll file
StrFileType = "application/x-msdownload"
Case ".html", ".htm"
'Html file
StrFileType = "text/HTML"
Case ".txt"
'Txt file
StrFileType = "text/plain"
Case ".jpeg", ".jpg"
'Jpg picture
StrFileType = "image/JPEG"
Case Else
StrFileType = "application/octet-stream"
End Select
'Clear the headers
Response.ClearHeaders()
Response.ClearContent()
Response.Clear()
'Add the download headers
Response.ContentType = "application/octet-stream"
Response.AddHeader("Content-Disposition", "attachment; filename=" + Name)
If StrFileType <> "" Then
Response.ContentType = StrFileType
End If
Response.AddHeader("Content-Length", DownloadFileInfo.Length)
Dim buffer(10000) As Byte
Dim length As Long
'Total bytes to read:
Dim bytesToRead As Long = stream.Length
Dim UserHasDownload As Boolean = False
Try
'Read the bytes from the stream in small portions.
While (bytesToRead > 0)
'Make sure the client is still connected.
If (Response.IsClientConnected) Then
'Read the data into the buffer and write into the output stream.
length = Int(stream.Read(buffer, 0, 10000))
Response.OutputStream.Write(buffer, 0, length)
Response.Flush()
'We have already read some bytes.. need to read only the remaining.
bytesToRead = bytesToRead - length
UserHasDownload = True
Else
'Get out of the loop, if user is not connected anymore..
bytesToRead = -1
UserHasDownload = False
End If
End While
Catch
'An error occurred..
Finally
End Try
stream.Close()


 
Reply With Quote
 
 
 
 
Ray Costanzo [MVP]
Guest
Posts: n/a
 
      07-12-2005
"There was no way for you to know it, but this is a classic asp newsgroup.
While you may be lucky enough to find a dotnet-knowledgeable person here who
can answer your question, you can eliminate the luck factor by posting your
question to a group where those dotnet-knowledgeable people hang out. I
suggest microsoft.public.dotnet.framework.aspnet."

Ray at work

Response courtesy of Bob Barrows

"Thomas Andersson" <> wrote in
message news:5851C83E-CA56-41C6-B51D-...
> Hi,
>
> I am trying to find a working solution for download of large files

(400-800
> MB)...
> But this seems almost impossible to find a working example.
>
> I have tried Response.Transmitfile, this works for some peoplebut in my
> case the server reset the connection after approx. 20 minutes and

sometimes
> after
> 7-8 minutesthe download speed is however very good 400MB takes about 10
> minutes to download.
>
> I have also tried the code below, this solution also resets the connection
> after 4-5 MBand the download goes very slow approx. 55 kb/s
>
> Please does anyone have any ideas or proposals?
> Is it possible to download via FTP?
> Is it possible to use resume of broken downloads somehow?
> Are there any components on the market that can achieve this?
>
> 'Download the selected file



 
Reply With Quote
 
 
 
 
Thomas Andersson
Guest
Posts: n/a
 
      07-12-2005
Hi Ray,

Thank you for letting me know this.
The reason that I posted here was that I have already posted my question on
the microsoft.public.dotnet.framework.aspnet forum.
Bu no one has answered two of my earlier questions on that forum.
So I was hoping that someone here could answer…


/Thomas ;o)

"Ray Costanzo [MVP]" wrote:

> "There was no way for you to know it, but this is a classic asp newsgroup.
> While you may be lucky enough to find a dotnet-knowledgeable person here who
> can answer your question, you can eliminate the luck factor by posting your
> question to a group where those dotnet-knowledgeable people hang out. I
> suggest microsoft.public.dotnet.framework.aspnet."¹
>
> Ray at work
>
> ¹ Response courtesy of Bob Barrows
>
> "Thomas Andersson" <> wrote in
> message news:5851C83E-CA56-41C6-B51D-...
> > Hi,
> >
> > I am trying to find a working solution for download of large files

> (400-800
> > MB)...
> > But this seems almost impossible to find a working example.
> >
> > I have tried Response.Transmitfile, this works for some people…but in my
> > case the server reset the connection after approx. 20 minutes and

> sometimes
> > after
> > 7-8 minutes…the download speed is however very good 400MB takes about 10
> > minutes to download.
> >
> > I have also tried the code below, this solution also resets the connection
> > after 4-5 MB…and the download goes very slow approx. 55 kb/s…
> >
> > Please does anyone have any ideas or proposals?
> > Is it possible to download via FTP?
> > Is it possible to use resume of broken downloads somehow?
> > Are there any components on the market that can achieve this?
> >
> > 'Download the selected file

>
>
>

 
Reply With Quote
 
Evertjan.
Guest
Posts: n/a
 
      07-12-2005
=?Utf-8?B?VGhvbWFzIEFuZGVyc3Nvbg==?= wrote on 12 jul 2005 in
microsoft.public.inetserver.asp.general:

> Hi Ray,
>
> Thank you for letting me know this.
> The reason that I posted here was that I have already posted my
> question on the microsoft.public.dotnet.framework.aspnet forum.
> Bu no one has answered two of my earlier questions on that forum.
> So I was hoping that someone here could answer
>


There was no way for Ray to know that. ;-}

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

 
Reply With Quote
 
Thomas Andersson
Guest
Posts: n/a
 
      07-12-2005
Hi Evertjan,

Well that is true...
I was only answering, I did not mean to be unpleasant

"Evertjan." wrote:

> =?Utf-8?B?VGhvbWFzIEFuZGVyc3Nvbg==?= wrote on 12 jul 2005 in
> microsoft.public.inetserver.asp.general:
>
> > Hi Ray,
> >
> > Thank you for letting me know this.
> > The reason that I posted here was that I have already posted my
> > question on the microsoft.public.dotnet.framework.aspnet forum.
> > Bu no one has answered two of my earlier questions on that forum.
> > So I was hoping that someone here could answerƒ Ý
> >

>
> There was no way for Ray to know that. ;-}
>
> --
> Evertjan.
> The Netherlands.
> (Replace all crosses with dots in my emailaddress)
>
>

 
Reply With Quote
 
Evertjan.
Guest
Posts: n/a
 
      07-12-2005
=?Utf-8?B?VGhvbWFzIEFuZGVyc3Nvbg==?= wrote on 12 jul 2005 in
microsoft.public.inetserver.asp.general:
>> =?Utf-8?B?VGhvbWFzIEFuZGVyc3Nvbg==?= wrote on 12 jul 2005 in
>> microsoft.public.inetserver.asp.general:
>>
>> > Hi Ray,
>> >
>> > Thank you for letting me know this.
>> > The reason that I posted here was that I have already posted my
>> > question on the microsoft.public.dotnet.framework.aspnet forum.
>> > Bu no one has answered two of my earlier questions on that forum.
>> > So I was hoping that someone here could answerƒ Ý
>> >

>>
>> There was no way for Ray to know that. ;-}

>
> Well that is true...
> I was only answering, I did not mean to be unpleasant


It wasn't ment to be reproachful.

I just liked to echo the "no way to know".

[However, in general, if you you try a second NG with the same Q,
better say so to prevent multiposting flames.]


--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Direct Download Movies - No Download Limits - Download DivX DVDMovies hussain dandan Python 0 12-06-2009 04:52 AM
How to download large (400MB +) files from an asp.net page??? =?Utf-8?B?VGhvbWFzIEFuZGVyc3Nvbg==?= ASP .Net 0 07-12-2005 09:05 AM
Unable to download large files with Mozilla Firefox Chris de Bruin Firefox 4 04-03-2005 11:05 PM
Backing Up Large Files..Or A Large Amount Of Files Scott D. Weber For Unuathorized Thoughts Inc. Computer Support 1 09-19-2003 07:28 PM



Advertisments