473,406 Members | 2,345 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

sending HUGE file to client via Response.BinaryWrite

Zam
Hello World,

Under Windows 2003 Server. IIS6.

The following code working fine for small files, and for files with size
about few megabytes.

If I am trying to send HUGE file -- about 700 Megabyte -- w3wp.exe eat all
memory (I have 1024 megabytes) and all CPU time without positive result.

Question: how could i _clever_ and fast send very huge file to client, with
keeping "file location privacy" ?

<%
Response.Buffer = False
Server.ScriptTimeout = 30000

Response.ContentType = "application/x-unknown"
fn = "movie1.avi"
FPath = "g:\movies\" & fn
Response.AddHeader "Content-Disposition", "attachment; filename=" & fn

Set adoStream = CreateObject("ADODB.Stream")
chunk = 2048
adoStream.Open()
adoStream.Type = 1
adoStream.LoadFromFile(FPath)

iSz = adoStream.Size

Response.AddHeader "Content-Length", iSz

For i = 1 To iSz \ chunk
If Not Response.IsClientConnected Then Exit For
Response.BinaryWrite adoStream.Read(chunk)
Next

If iSz Mod chunk > 0 Then
If Response.IsClientConnected Then
Response.BinaryWrite objStream.Read(iSz Mod chunk)
End If
End If

adoStream.Close
Set adoStream = Nothing

Response.End
%>

With best regards,
Jul 22 '05 #1
2 7164
Not familiar with streams so this is mostly a guess but you might try making
sure that the stream's "mode" is set to adModeRead (=1).

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"Zam" <za*@parks.lv> wrote in message
news:eK**************@TK2MSFTNGP15.phx.gbl...
Hello World,

Under Windows 2003 Server. IIS6.

The following code working fine for small files, and for files with size
about few megabytes.

If I am trying to send HUGE file -- about 700 Megabyte -- w3wp.exe eat all
memory (I have 1024 megabytes) and all CPU time without positive result.

Question: how could i _clever_ and fast send very huge file to client, with keeping "file location privacy" ?

<%
Response.Buffer = False
Server.ScriptTimeout = 30000

Response.ContentType = "application/x-unknown"
fn = "movie1.avi"
FPath = "g:\movies\" & fn
Response.AddHeader "Content-Disposition", "attachment; filename=" & fn

Set adoStream = CreateObject("ADODB.Stream")
chunk = 2048
adoStream.Open()
adoStream.Type = 1
adoStream.LoadFromFile(FPath)

iSz = adoStream.Size

Response.AddHeader "Content-Length", iSz

For i = 1 To iSz \ chunk
If Not Response.IsClientConnected Then Exit For
Response.BinaryWrite adoStream.Read(chunk)
Next

If iSz Mod chunk > 0 Then
If Response.IsClientConnected Then
Response.BinaryWrite objStream.Read(iSz Mod chunk)
End If
End If

adoStream.Close
Set adoStream = Nothing

Response.End
%>

With best regards,

Jul 22 '05 #2
Zam
Hello Mark,

Unfortunatly, the same negative result (eat all RAM and CPU time):

Error number: -2147024882
Error description: Not enough storage is available to complete this
operation.

Error line: adoStream.LoadFromFile(FPath)

With best regards,

"Mark Schupp" <no****@nospam.com> wrote in message
news:Or**************@TK2MSFTNGP09.phx.gbl...
Not familiar with streams so this is mostly a guess but you might try making sure that the stream's "mode" is set to adModeRead (=1).

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"Zam" <za*@parks.lv> wrote in message
news:eK**************@TK2MSFTNGP15.phx.gbl...
Hello World,

Under Windows 2003 Server. IIS6.

The following code working fine for small files, and for files with size
about few megabytes.

If I am trying to send HUGE file -- about 700 Megabyte -- w3wp.exe eat all memory (I have 1024 megabytes) and all CPU time without positive result.

Question: how could i _clever_ and fast send very huge file to client,

with
keeping "file location privacy" ?

<%
Response.Buffer = False
Server.ScriptTimeout = 30000

Response.ContentType = "application/x-unknown"
fn = "movie1.avi"
FPath = "g:\movies\" & fn
Response.AddHeader "Content-Disposition", "attachment; filename=" & fn
Set adoStream = CreateObject("ADODB.Stream")
chunk = 2048
adoStream.Open()
adoStream.Type = 1
adoStream.LoadFromFile(FPath)

iSz = adoStream.Size

Response.AddHeader "Content-Length", iSz

For i = 1 To iSz \ chunk
If Not Response.IsClientConnected Then Exit For
Response.BinaryWrite adoStream.Read(chunk)
Next

If iSz Mod chunk > 0 Then
If Response.IsClientConnected Then
Response.BinaryWrite objStream.Read(iSz Mod chunk)
End If
End If

adoStream.Close
Set adoStream = Nothing

Response.End
%>

With best regards,


Jul 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Vince C. | last post by:
Hi. This is a feature that is really going on my nerves as I've been writing SOAP Web services using ASP and SOAP toolkit 3.0. My web services ASP scripts send XML data to the client...
0
by: PJ | last post by:
I have the following code snippet to send a file stored as an image data type from sql server: Protected Sub StreamFile(ByVal fileItem As MyFile) Dim offset As Integer Dim buffer As Integer =...
1
by: frenchie seb via .NET 247 | last post by:
Hi ! here's the code of the function I use to send a file to the client : Private Function SendFile(ByVal fich As String, ByVal nom As String) As Boolean Try Dim oldCT As String =...
4
by: Schwarty | last post by:
I hope I posted this to the correct group. If not, please let me know and I will get it posted in the correct section. I have a web application developed in ASP.NET using C# for the code behind....
13
by: Prabhat | last post by:
Hi Friends, I have code that will "BinaryWrite" a EXE file of 20mb to client using the ADO Stream. After the download the EXE file works fine without any problem. When I verified the EXE that...
5
by: twiggy182 | last post by:
Hi, I really need you help because I'm not very familliar with ASP and I could not find any solution to my problem. To put you in situation, I have a CGI to which I send a file name, and that...
5
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, The following code was suggested by one of the users in this newsgroup when a pdf file was requested by a user from an asp page. I used the similar code in my page and the very interesting...
1
by: .nLL | last post by:
hi everyone. i use asp to send files to users to prevent hotlinking and i always used following code Response.ContentType="video/3gpp" response.addheader "Content-Disposition",...
14
by: S N | last post by:
I am using the following code to hide the download url of files on my website. The code uses Response.Binarywrite to send file to the client. Kindly indicate the maximum size of the file that can be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.