I am using the following code to hide the download url of files on my website. The code uses Response.Binary write 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 Response.AddHea der("Content-Disposition","a ttachment; filename=""" & strFileSave & """")
Response.Conten tType = "bad/type"
Set Fsys = Server.CreateOb ject("Scripting .FileSystemObje ct")
Set TS = Fsys.GetFile(st rFile).OpenAsTe xtStream(1, -1)
Do While Not (TS.AtEndOfStre am)
Response.Binary Write(TS.Read(1 ))
Loop
Sep 7 '08
14 11914
Also advise the content type in case the file is an excel file, word
document, exe file, zip file etc.
Thanks in advance.
"Anthony Jones" <An***********@ yadayadayada.co mwrote in message
news:e9******** ******@TK2MSFTN GP02.phx.gbl...
"S N" <ua******@yahoo .comwrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
>What if we want to use sendfiletorespo nse but dont want to force the save as dialog, instead just want to see the pdf file within the browser window itself. is there any change required in the code to achieve this.
If you know its a pdf then change content-type to application/pdf and
remove the attachment; keyword from content-disposition.
--
Anthony Jones - MVP ASP/ASP.NET
"S N" wrote:
Just one clarification
You intended
For i = 1 To oStream.Size / clChunkSize
or
For i = 1 To oStream.Size \ clChunkSize
He *intended* the latter.
The backslash operator means "integer division" in VBScript (and VB and
VB.NET) code.
That is,
a \ b
is equivalent to
INT( a / b )
*************** *****
Also, you don't need to mess with Response.Buffer =False, at all.
Just follow each
Response.Binary Write
with
Response.Flush
Now the buffer will never get more full than one "chunkSize" .
"Old Pedant" <Ol*******@disc ussions.microso ft.comwrote in message
news:85******** *************** ***********@mic rosoft.com...
>
"S N" wrote:
>Just one clarification You intended For i = 1 To oStream.Size / clChunkSize or For i = 1 To oStream.Size \ clChunkSize
He *intended* the latter.
The backslash operator means "integer division" in VBScript (and VB and
VB.NET) code.
That is,
a \ b
is equivalent to
INT( a / b )
*************** *****
Also, you don't need to mess with Response.Buffer =False, at all.
Just follow each
Response.Binary Write
with
Response.Flush
Now the buffer will never get more full than one "chunkSize" .
Yes that would work. However it would mask unintended errors that turning
the buffer off right at the top of the code exposes.
--
Anthony Jones - MVP ASP/ASP.NET
"Anthony Jones" <An***********@ yadayadayada.co mwrote in message
news:us******** ******@TK2MSFTN GP05.phx.gbl...
"Old Pedant" <Ol*******@disc ussions.microso ft.comwrote in message
news:85******** *************** ***********@mic rosoft.com...
>>
"S N" wrote:
>>Just one clarification You intended For i = 1 To oStream.Size / clChunkSize or For i = 1 To oStream.Size \ clChunkSize
He *intended* the latter.
The backslash operator means "integer division" in VBScript (and VB and VB.NET) code.
That is, a \ b is equivalent to INT( a / b )
************** ******
Also, you don't need to mess with Response.Buffer =False, at all.
Just follow each Response.Binary Write with Response.Flush
Now the buffer will never get more full than one "chunkSize" .
Yes that would work. However it would mask unintended errors that turning
the buffer off right at the top of the code exposes.
--
Anthony Jones - MVP ASP/ASP.NET
what kind of errors would be exposed by turning off the buffer. kindly
elaborate.
"S N" <ua******@yahoo .comwrote in message
news:OY******** *****@TK2MSFTNG P02.phx.gbl...
>
"Anthony Jones" <An***********@ yadayadayada.co mwrote in message
news:us******** ******@TK2MSFTN GP05.phx.gbl...
>"Old Pedant" <Ol*******@disc ussions.microso ft.comwrote in message news:85******* *************** ************@mi crosoft.com...
>>>
"S N" wrote:
Just one clarification You intended For i = 1 To oStream.Size / clChunkSize or For i = 1 To oStream.Size \ clChunkSize
He *intended* the latter.
The backslash operator means "integer division" in VBScript (and VB and VB.NET) code.
That is, a \ b is equivalent to INT( a / b )
************* *******
Also, you don't need to mess with Response.Buffer =False, at all.
Just follow each Response.Binary Write with Response.Flush
Now the buffer will never get more full than one "chunkSize" . Yes that would work. However it would mask unintended errors that turning the buffer off right at the top of the code exposes.
what kind of errors would be exposed by turning off the buffer. kindly
elaborate.
Well the sort of problems you've discovered where you may unintentionaly be
placing things in the output buffer that you didn't want present. Example:-
<!-- #include /virtual="/someinclude.asp " -->
<%
Response.Conten tType = "applicatio n/octet-stream"
Do Until ....
Response.Binary Write SomeStuff
Response.Flush
Loop
%>
'someinclude.as p
<!-- Ooops some accidental static content here -->
<%
'utility code
%>
Placing a Response.Buffer at the top of your page would barf immediately on
that line alerting you to a problem.
It also saves you having to remember to Response.Flush if you have multiple
places where you write to the buffer.
--
Anthony Jones - MVP ASP/ASP.NET This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Milan |
last post by:
Hi!
I am loading XML file this way:
oDom = Server.CreateObject("Microsoft.XMLDOM")
oDom.async = False
If oDom.Load(Server.MapPath("lang/EN.xml")) Then
GetXMLDocument = oDom.documentElement
Else
|
by: steve |
last post by:
I am setting up a huge database in mysql, and I get the above error in
Linux. I believe it is related to the size of one of my tables, which
is 4,294,966,772 bytes in size. Can someone help. How can I break
that barrier.
A google search did not turn up anything useful.
--
Posted using the http://www.dbforumz.com interface, at author's request
Articles individually checked for conformance to usenet standards
|
by: Peter Ballard |
last post by:
Hi all,
I've got a C program which outputs all its data using a statement of
the form:
putchar(ch, outfile);
This has worked fine for years until it had to output more than 2GB of
data today, and I got a "file size limit exceeded" error.
|
by: Ben |
last post by:
I use the following method to export data to an excel
file. Is there a size limit? It seems that the size is
big (about 2, 3 MB), it hangs when attempt to open the
file.
Response.Clear() ;
Response.ContentType = "application/vnd.ms-excel";
Response.AddHeader ("Content-
Disposition", "attachment;filename=list.doc") ;
Response.Write ("<TABLE border=1 cellPadding=1
|
by: Amod |
last post by:
Hi,
I m copying data from a video stream on the hard disk using a C++
programme in win32 API. my current file system is FAT32 .. the file
size limit of FAT32 is 4GB. I want to automatically split the file if
the file size is greater than 4GB and create a new file with the
incoming data. How can I perform the above task . Please guide me.
Regards,
Amod
| |
by: Amod |
last post by:
Hi,
I m copying data from a video stream on the hard disk using a C++
programme in win32 API. my current file system is FAT32 .. the file
size limit of FAT32 is 4GB. I want to automatically split the file if
the file size is greater than 4GB and create a new file with the
incoming data. How can I perform the above task . Please guide me.
Regards,
Amod
|
by: eastcoastguyz |
last post by:
I wrote a simple program to continue to create a very large file (on
purpose), and even though there is plenty of disk space on that device
the program aborted with the error message "File Size Limit Exceeded".
The file size was 2147483647. I checked ulimit -a and its set to
unlimited.
Is this a compiler issue? I would like to see a C code example of how
to increase the limit or make it unlimited (if that is a wise thing to
do).
|
by: MichiMichi |
last post by:
I am trying to secure filedownload via streaming to protect files on
the server. This works very well but when I open the file in a notepad
editor it shows always HTML code at the end of the file.
Since the code runs in a aspx file, the added HTML Code always
streamed at the end.
What do I have to do so the files are stored without the HTML tags on
the client machine?
|
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...
|
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...
|
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...
| |
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...
|
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...
|
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...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
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
| |
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...
| |