473,399 Members | 3,302 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,399 software developers and data experts.

Response.write is asynchronous?

I am creating a ZIP file on the fly and streaming it out to the client using Response.WriteFile(FileName, StartPos,
FileSize). Because this ZIP contains files that are on my server and I don't really want a bunch of duplcate data
filling up my server I need to delete the ZIP file after it's streamed to the client. So I do something like this:

Response.WriteFile(FileName, StartPos, FileSize)
File.Delete(filelocation & FileName)

Well this doesn't work very well because apparently the response is still being written when the delete command is
issued. Buffering is not on and I don't really want it on because I don't think there is enough server RAM to ever
handle the amount buffering that this would require (these zip files can be very large, like 50 MB just for one user).
So, what's a developer to do?

--Buddy
Nov 19 '05 #1
2 2164
Write it to the file system instead and provide them with a link, or a
redirect to the link to it'll automatically start downloading. Then, delete
the file. If something goes wrong and the operation can't be completed,
either provide a way so the system will re-use the same file for the user,
or after a certain amount of time it'll automatically be purged.
Thanks,
Shawn
"Buddy Ackerman" <bu**********@buddyackerman.com> wrote in message
news:uS**************@tk2msftngp13.phx.gbl...
I am creating a ZIP file on the fly and streaming it out to the client using Response.WriteFile(FileName, StartPos, FileSize). Because this ZIP contains files that are on my server and I don't really want a bunch of duplcate data filling up my server I need to delete the ZIP file after it's streamed to the client. So I do something like this:
Response.WriteFile(FileName, StartPos, FileSize)
File.Delete(filelocation & FileName)

Well this doesn't work very well because apparently the response is still being written when the delete command is issued. Buffering is not on and I don't really want it on because I don't think there is enough server RAM to ever handle the amount buffering that this would require (these zip files can be very large, like 50 MB just for one user). So, what's a developer to do?

--Buddy

Nov 19 '05 #2
I am writing the file to the disk. The response.writefile apparently releases and allows the next statement to execute
before the write is complete. Probably does this so as to not tie up the script longer than the script timeout setting.

Guess I'll have to setup a separate process tah cleans up the directory where these files are stored.

--Buddy

Shawn B. wrote:
Write it to the file system instead and provide them with a link, or a
redirect to the link to it'll automatically start downloading. Then, delete
the file. If something goes wrong and the operation can't be completed,
either provide a way so the system will re-use the same file for the user,
or after a certain amount of time it'll automatically be purged.
Thanks,
Shawn
"Buddy Ackerman" <bu**********@buddyackerman.com> wrote in message
news:uS**************@tk2msftngp13.phx.gbl...
I am creating a ZIP file on the fly and streaming it out to the client


using Response.WriteFile(FileName, StartPos,
FileSize). Because this ZIP contains files that are on my server and I


don't really want a bunch of duplcate data
filling up my server I need to delete the ZIP file after it's streamed to


the client. So I do something like this:
Response.WriteFile(FileName, StartPos, FileSize)
File.Delete(filelocation & FileName)

Well this doesn't work very well because apparently the response is still


being written when the delete command is
issued. Buffering is not on and I don't really want it on because I don't


think there is enough server RAM to ever
handle the amount buffering that this would require (these zip files can


be very large, like 50 MB just for one user).
So, what's a developer to do?

--Buddy


Nov 19 '05 #3

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

Similar topics

6
by: No_Excuses | last post by:
All, I am interested in reading the text of a web page and parsing it. After searching on this newgroup I decided to use the following: ******************************* START OF CODE...
2
by: Ronald Geyeshock | last post by:
Hello All, I am trying to find a way to process some logic in the code-behind of an ASP.Net page after a response has been sent back to the client. Basically, I want to be able to process some...
1
by: Julian Hershel | last post by:
Reading about asynchronous programming (ms-help://MS.NETFrameworkSDK/cpguidenf/html/cpconasynchronousdesignpatterno verview.htm) I could not clarify some doubts. Hope you can help me. 1) Are...
9
by: jacob | last post by:
Hi everyone: I have a problem in ASP NET. Here is my situation. I developed an ASP NET application. It concerns data statistics. DB is oracle 10g, Web server is IIS 6.0, Server OS is Win2003,...
4
by: evgenyg | last post by:
Hello ! We have the following situation - when Ajax request is sent what's being returned by the server is usually an XML (which is used for DOM updates) but sometimes it's HTML which is a whole...
3
by: sean.j.gage | last post by:
We are building a web service for a client application that will need to send information in the Header of the web service responses. What's the best way to access this header information from the...
2
by: Nicolas Le Gland | last post by:
Hello everyone here. This is my first post in this newsgroup, I hope I won't be to much off-topic. Feel free to redirect me to any better group. I am getting strange timing issues when...
0
by: est | last post by:
I am writing a small 'comet'-like app using flup, something like this: def myapp(environ, start_response): start_response('200 OK', ) return <-------------Could this be part of...
1
by: sanjupommen | last post by:
I am in the process of exploring the possibility of providing our products on databases other than Oracle.I am able to migrate the data, procedures etc without too much effort (latest version of DB2...
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
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
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...
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,...

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.