473,488 Members | 2,464 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

throttling download in ASP

Hi,

I am downloading files using ASP using the the binarywrite as below.

objStream.LoadFromFile(strAbsFile)
'-- send the stream in the response
Response.BinaryWrite(objStream.Read)

I was wondering is there any way I can control or throttle the
download?. I want to make sure that the users are not taking up too
much bandwidth while downloading the file.

Thanks for your help and time

:)

Aug 28 '06 #1
4 2306

"Katie" <Dn*********@gmail.comwrote in message
news:11*********************@m79g2000cwm.googlegro ups.com...
Hi,

I am downloading files using ASP using the the binarywrite as below.

objStream.LoadFromFile(strAbsFile)
'-- send the stream in the response
Response.BinaryWrite(objStream.Read)

I was wondering is there any way I can control or throttle the
download?. I want to make sure that the users are not taking up too
much bandwidth while downloading the file.

Thanks for your help and time

:)
The only way to do this without using an additional component is to put this
file in it's own application and enable I/O throttling (although that will
apply to all downloads currently in progress).

What version of IIS are you using?

I assume you have Response.Buffer = false in the code?

You should note that even with buffer = false the buffer limit is still in
effect for any single call to BinaryWrite. On IIS6 the default limit is 4MB
hence a file larger than this will break the limit. I would recommend that
you use a for loop to chunk the contents to BinaryWrite. This does have the
effect of slowing the download (with no buffer, binarywrite will become
dependant of client acknowledgments) so use a chunk size of say 2Mb to
minimize this impact.

If you can build and use additional components you can use a chunking loop
to control bandwidth usage by using the sleep API to pause the loop a
little.

Anthony.
Aug 29 '06 #2
Below is a sub I wrote to download files by using response.binarywrite.
The code works fine, but is there any way to throttle it so that if the
clients are downloading large files (several hundred megs) they dont
take up all the bandwidth. I think the IIS version is 5, but ill
confirm that with the sys admin

thanks for ure help
:)

Private Sub streamDocs(path, filename, originalFileName, contentType)

Response.AddHeader
"content-disposition","attachment;filename="&originalFileNa me
Response.ContentType = contentType
Dim BinaryStream, Fil, fs
Set BinaryStream = CreateObject("ADODB.Stream")

set fs = Server.CreateObject("Scripting.FileSystemObject")

Set Fil = fs.GetFile(path & "\" &filename) 'Open file

BinaryStream.Type = 1
BinaryStream.Open
BinaryStream.LoadFromFile Fil.path
Response.BinaryWrite BinaryStream.Read
BinaryStream.Cancel
BinaryStream.Close
set BinaryStream = nothing

End sub
Anthony Jones wrote:
"Katie" <Dn*********@gmail.comwrote in message
news:11*********************@m79g2000cwm.googlegro ups.com...
Hi,

I am downloading files using ASP using the the binarywrite as below.

objStream.LoadFromFile(strAbsFile)
'-- send the stream in the response
Response.BinaryWrite(objStream.Read)

I was wondering is there any way I can control or throttle the
download?. I want to make sure that the users are not taking up too
much bandwidth while downloading the file.

Thanks for your help and time

:)

The only way to do this without using an additional component is to put this
file in it's own application and enable I/O throttling (although that will
apply to all downloads currently in progress).

What version of IIS are you using?

I assume you have Response.Buffer = false in the code?

You should note that even with buffer = false the buffer limit is still in
effect for any single call to BinaryWrite. On IIS6 the default limit is 4MB
hence a file larger than this will break the limit. I would recommend that
you use a for loop to chunk the contents to BinaryWrite. This does have the
effect of slowing the download (with no buffer, binarywrite will become
dependant of client acknowledgments) so use a chunk size of say 2Mb to
minimize this impact.

If you can build and use additional components you can use a chunking loop
to control bandwidth usage by using the sleep API to pause the loop a
little.

Anthony.
Aug 29 '06 #3

"Katie" <Dn*********@gmail.comwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
Below is a sub I wrote to download files by using response.binarywrite.
The code works fine, but is there any way to throttle it so that if the
clients are downloading large files (several hundred megs) they dont
take up all the bandwidth. I think the IIS version is 5, but ill
confirm that with the sys admin

thanks for ure help
:)

Private Sub streamDocs(path, filename, originalFileName, contentType)

Response.AddHeader
"content-disposition","attachment;filename="&originalFileNa me
Response.ContentType = contentType
Dim BinaryStream, Fil, fs
Set BinaryStream = CreateObject("ADODB.Stream")

set fs = Server.CreateObject("Scripting.FileSystemObject")

Set Fil = fs.GetFile(path & "\" &filename) 'Open file

BinaryStream.Type = 1
BinaryStream.Open
BinaryStream.LoadFromFile Fil.path
Response.BinaryWrite BinaryStream.Read
BinaryStream.Cancel
BinaryStream.Close
set BinaryStream = nothing

End sub
This doesn't really tell me anything new. The short answer is no.
However the advice I have already given still stands.

BTW why FileSystemObject? doesn't:-

BinaryStream.LoadFromFile path & "\" & filename

work for you?

Also what does:-

BinaryStream.Cancel

do?
Anthony Jones wrote:
"Katie" <Dn*********@gmail.comwrote in message
news:11*********************@m79g2000cwm.googlegro ups.com...
Hi,
>
I am downloading files using ASP using the the binarywrite as below.
>
objStream.LoadFromFile(strAbsFile)
'-- send the stream in the response
Response.BinaryWrite(objStream.Read)
>
I was wondering is there any way I can control or throttle the
download?. I want to make sure that the users are not taking up too
much bandwidth while downloading the file.
>
Thanks for your help and time
>
:)
>
The only way to do this without using an additional component is to put
this
file in it's own application and enable I/O throttling (although that
will
apply to all downloads currently in progress).

What version of IIS are you using?

I assume you have Response.Buffer = false in the code?

You should note that even with buffer = false the buffer limit is still
in
effect for any single call to BinaryWrite. On IIS6 the default limit is
4MB
hence a file larger than this will break the limit. I would recommend
that
you use a for loop to chunk the contents to BinaryWrite. This does have
the
effect of slowing the download (with no buffer, binarywrite will become
dependant of client acknowledgments) so use a chunk size of say 2Mb to
minimize this impact.

If you can build and use additional components you can use a chunking
loop
to control bandwidth usage by using the sleep API to pause the loop a
little.

Anthony.

Aug 29 '06 #4
B
Hi,

Thanks for your email.
I am a little confused regarding the loop you are talking about.

I appologize for posting on more than one group, i wasnt sure which
group this would fit under

Thanks
:)

Anthony Jones wrote:
"Katie" <Dn*********@gmail.comwrote in message
news:11*********************@m79g2000cwm.googlegro ups.com...
Hi,

I am downloading files using ASP using the the binarywrite as below.

objStream.LoadFromFile(strAbsFile)
'-- send the stream in the response
Response.BinaryWrite(objStream.Read)

I was wondering is there any way I can control or throttle the
download?. I want to make sure that the users are not taking up too
much bandwidth while downloading the file.

Thanks for your help and time

:)

The only way to do this without using an additional component is to put this
file in it's own application and enable I/O throttling (although that will
apply to all downloads currently in progress).

What version of IIS are you using?

I assume you have Response.Buffer = false in the code?

You should note that even with buffer = false the buffer limit is still in
effect for any single call to BinaryWrite. On IIS6 the default limit is 4MB
hence a file larger than this will break the limit. I would recommend that
you use a for loop to chunk the contents to BinaryWrite. This does have the
effect of slowing the download (with no buffer, binarywrite will become
dependant of client acknowledgments) so use a chunk size of say 2Mb to
minimize this impact.

If you can build and use additional components you can use a chunking loop
to control bandwidth usage by using the sleep API to pause the loop a
little.

Anthony.
Aug 29 '06 #5

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

Similar topics

6
8504
by: chon | last post by:
I have an ASP page that is sent a file location as a parameter. It opens this file, loads the ADODB.Stream object and does a binary write to the page forcing the download dialog to appear. This...
0
1879
by: Sarah Akers | last post by:
GgF ----gL5cJ72EqiGIQ0SK65Rz Content-Type: text/html; Content-Transfer-Encoding: quoted-printable <html> <head> <style type=3D"text/css">.eyebrow { FONT-WEIGHT: bold; FONT-SIZE: 10px; TE=
0
2559
by: jmd | last post by:
Hello. I want to write a C# program that does completely automatically what, until now, I do manually, witch is describe below : 1. I launch IE (6) 2. I browse to my desired download page, say...
0
1524
by: Rex Winn | last post by:
Hi all I am looking for code/articles that can show me how to implement bandwidth throttling on a local machine using C/C++. The reason being is that I have users on Satellite Internet that if...
0
1161
by: Lu | last post by:
hi. Anyone have an example or tips on on how to do CPU throttling using Job Objects with VB.NET ? The documentation on this is close to nothing. So far I have been able to: 1- create a job...
16
3218
by: matt | last post by:
I have used some free code for listing files for download, but I want to send an email to the administrator when the file has been downloaded. I have got some code in here that does it, but it will...
1
2144
by: JayLembeck | last post by:
Over 50,000 Free Ringtone. Get the Latest Ringtone. Download now- Fast, Free and Easy. Get your FREE surprise RINGTONE now! http://seekoutfast.info/free-ringtone/ free ringtone free ringtone new...
5
3665
by: Khafancoder | last post by:
Hi guys, i am building a FileSharing website, i wanna allow users to be able using download managers such as DAP to download files from webserver but don't allow them to retrive files url......
1
47343
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
0
7108
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
6967
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7142
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,...
0
7181
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...
1
6847
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
4875
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...
0
4565
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1383
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 ...
1
618
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.