473,785 Members | 2,895 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

sending HUGE file to client via Response.Binary Write

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.ScriptTi meout = 30000

Response.Conten tType = "applicatio n/x-unknown"
fn = "movie1.avi "
FPath = "g:\movies\ " & fn
Response.AddHea der "Content-Disposition", "attachment ; filename=" & fn

Set adoStream = CreateObject("A DODB.Stream")
chunk = 2048
adoStream.Open( )
adoStream.Type = 1
adoStream.LoadF romFile(FPath)

iSz = adoStream.Size

Response.AddHea der "Content-Length", iSz

For i = 1 To iSz \ chunk
If Not Response.IsClie ntConnected Then Exit For
Response.Binary Write adoStream.Read( chunk)
Next

If iSz Mod chunk > 0 Then
If Response.IsClie ntConnected Then
Response.Binary Write objStream.Read( iSz Mod chunk)
End If
End If

adoStream.Close
Set adoStream = Nothing

Response.End
%>

With best regards,
Jul 22 '05 #1
2 7211
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******** ******@TK2MSFTN GP15.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.ScriptTi meout = 30000

Response.Conten tType = "applicatio n/x-unknown"
fn = "movie1.avi "
FPath = "g:\movies\ " & fn
Response.AddHea der "Content-Disposition", "attachment ; filename=" & fn

Set adoStream = CreateObject("A DODB.Stream")
chunk = 2048
adoStream.Open( )
adoStream.Type = 1
adoStream.LoadF romFile(FPath)

iSz = adoStream.Size

Response.AddHea der "Content-Length", iSz

For i = 1 To iSz \ chunk
If Not Response.IsClie ntConnected Then Exit For
Response.Binary Write adoStream.Read( chunk)
Next

If iSz Mod chunk > 0 Then
If Response.IsClie ntConnected Then
Response.Binary Write 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.LoadF romFile(FPath)

With best regards,

"Mark Schupp" <no****@nospam. com> wrote in message
news:Or******** ******@TK2MSFTN GP09.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******** ******@TK2MSFTN GP15.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.ScriptTi meout = 30000

Response.Conten tType = "applicatio n/x-unknown"
fn = "movie1.avi "
FPath = "g:\movies\ " & fn
Response.AddHea der "Content-Disposition", "attachment ; filename=" & fn
Set adoStream = CreateObject("A DODB.Stream")
chunk = 2048
adoStream.Open( )
adoStream.Type = 1
adoStream.LoadF romFile(FPath)

iSz = adoStream.Size

Response.AddHea der "Content-Length", iSz

For i = 1 To iSz \ chunk
If Not Response.IsClie ntConnected Then Exit For
Response.Binary Write adoStream.Read( chunk)
Next

If iSz Mod chunk > 0 Then
If Response.IsClie ntConnected Then
Response.Binary Write 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
4460
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 application. When I'm debugging under Visual Sudio, IIS prefixes *all* streams that go to the client with <!-- METADATA TYPE="ASP_DEBUG_INFO">. I'm using XMLHTTP in some cases to receive data. Neither XMLHTTP v3 nor v4 seem to accept this as valid XML. I...
0
3942
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 = 8192 Dim textPtr As System.Data.SqlTypes.SqlBinary = MyFactory.GetFilePtr(fileItem.ID, FileScale.Original) Response.Clear()
1
1139
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 = Response.ContentType
4
4232
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. I need to be able to print shipping labels from a web page within this application. The shipping label data is pulled from a 3rd party application and comes in binary format specific for certain brands of label printers. I have a class library...
13
2459
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 gets downloaded to client machine that EXE has the below text added to the bottom: --------------------------------------------- <font face="Arial" size=2>.<p>Active Server Pages</font> <font face="Arial" size=2>error 'ASP 0113'</font>.<p>.<font...
5
12089
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 script return me that file. But for security reason, I don't want to publish the address of this CGI, so I encapsulated it in an ASP file. This way, only this ASP file knows where the CGI is.
5
3949
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 thing is when the pdf is displayed on the fly, the whole page is a gibberish code in stead of a normal pdf file. But it displays fine if I just use a link to a file on the page. Can you tell me what's the possible reason will cause this problem?...
1
6279
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", "attachment;filename="& file & ";" Set objStream = Server.CreateObject("ADODB.Stream") objStream.Open
14
11916
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 downloaded using this method. I am hosting this site on a public server, so I will not be able to change anything on the webserver. Kindly indicate what can be done to ensure that the above method remains valid for any file size download. call...
0
9645
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10325
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10148
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9950
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8972
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7499
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
4053
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3646
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2879
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.