473,387 Members | 1,673 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,387 software developers and data experts.

Determine whether download was cancelled

How can I determine whether a download has been cancelled by the
client? I'm sending the file from an aspx page in chunks of 4K. When
the user presses "Cancel" in his download dialog, the next call of
Response.Flush() hangs and resets my Session Object after about a
minute. The Response.IsClientConnected property is still true after
the user pressed "Cancel". Is there a workaround for this problem?
The Code is:

// fs --> FileStream
// buffer --> byte[]

while (offset < filesize)
{
length = filesize;
if (length > blocksize)
length = blocksize;
fs.Read(buffer, 0, (int)length);
Response.BinaryWrite(buffer);
if (Response.IsClientConnected)
Response.Flush(); // here it hangs after the user cancelling
else
break;
offset += length;
}

Thanks in advance.
Nov 18 '05 #1
0 1096

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

Similar topics

16
by: Donjuan | last post by:
Hi all I have trouble with tracking whether my image file is loaded. i use DHTML to change my image. HERE is the code: <img name="someimage" src="1.jpg"...
2
by: Admin | last post by:
Hi there I want to record in a Db when a file is download via my website. These are actual download links not someone flogging my sites images. I have an ahref pointing to my apsx page...
2
by: Chris Carter | last post by:
We have a site, for reference I'll call this MainSite, that has certain pages actually hosted on another site, I'll call this ChildSite. In MainSite when you click on a certain link, it loads a...
4
by: VBTricks.de.vu Webmaster | last post by:
Hello, at the moment I'm not able to finish my program. That means, I have a problem I can't solve myself. Therefore I'm asking those who already worked with HttpWebRequest... and threads. ...
0
by: NutsAboutVB | last post by:
Basically, the title explains it. I want to be able to read the first n bytes (say, 1024 bytes) of any file (text or binary) off the internet in my vb.net application. I specifically do not want...
2
by: Dan D | last post by:
I have a large install file (an exe) on my web server that people download and install from. Looking at my log files, I see a lot of people downloading it, but no way to tell for sure if they...
5
by: Dan D | last post by:
I have a large install file (an exe) on my web Apache server that people download and install from. Looking at my log files, I see a lot of people downloading it, but no way to tell for sure if...
158
by: jty0734 | last post by:
i don't know what input size of string is. so i can't gets inputsize before malloc function. i want determine the size of malloc without get inputsize in advance. how to deal with it?
1
by: Sehboo | last post by:
I have a site (www.motiont.com) where people can come and download a zip file. Is it possible for me to know when the file was fully downloaded (and not cancelled in the middle)? It is .net 2.0...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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,...

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.