473,795 Members | 2,892 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Abort a download

Hi,

I manually stream out a file in chunks from my web form using PageAsyncTask,
Page.Response.O utputStream.Beg inWrite and Flush after each chunk. I do set
the Content-Length header. If an error occurs (for example, a timeout), I do
the following:
response.Output Stream.Close();
response.Flush( );
response.Close( );

The trouble is, IE says that the download has completed successfully in
spite of the downloded file being incomplete. How can I force IE to display
an error (eg, Connection Was Reset) and abort the download?

Thanks!
--

May 26 '07 #1
5 1839
Hello muriwai,

See there the list of conversion libs http://csharp-source.net/open-source/pdf-libraries

---
WBR, Michael Nemtsev [.NET/C# MVP].
My blog: http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

mHi,
m>
mI manually stream out a file in chunks from my web form using
mPageAsyncTask,
mPage.Response. OutputStream.Be ginWrite and Flush after each chunk. I
mdo set
mthe Content-Length header. If an error occurs (for example, a
mtimeout), I do
mthe following:
mresponse.Outpu tStream.Close() ;
mresponse.Flush ();
mresponse.Close ();
mThe trouble is, IE says that the download has completed successfully
min spite of the downloded file being incomplete. How can I force IE
mto display an error (eg, Connection Was Reset) and abort the
mdownload?
m>
mThanks!
m>
May 26 '07 #2
Hello Michael ,

Emm, sorry, missed the tread :)

---
WBR, Michael Nemtsev [.NET/C# MVP].
My blog: http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

MNSee there the list of conversion libs
MNhttp://csharp-source.net/open-source/pdf-libraries
MN>
May 26 '07 #3
Hi Michael,

Based on my test, when you turn off buffer of the page resposne, it will
write out response headers at initial flush so that after the server-side
close or terminate the connection, the client-side will just act like the
response output finished. I've tried through exception or abort response or
worker thread but haven't got any effect. I think this due to the ASP.NET's
control over response is at a high application level that doen't deep
enough for the raw HTTP communication. For your scenario, you may consider
some IIS isapi filter solution as it can help much more control over the
underlying http communication.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

=============== =============== =============== =====

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

May 28 '07 #4
Hi Steven,

This looks like a bug in Internet Explorer when it offers an incomplete
download to a user, even though Content-Length does not match the actual
file length. According to
http://www.w3.org/Protocols/rfc2616/...c4.html#sec4.4, Content-Length
takes precedence over the server closing the connection. I'd pass this along
to the IE team.

Thanks
--

"Steven Cheng[MSFT]" <st*****@online .microsoft.comw rote in message
news:nj******** ******@TK2MSFTN GHUB02.phx.gbl. ..
Hi Michael,

Based on my test, when you turn off buffer of the page resposne, it will
write out response headers at initial flush so that after the server-side
close or terminate the connection, the client-side will just act like the
response output finished. I've tried through exception or abort response
or
worker thread but haven't got any effect. I think this due to the
ASP.NET's
control over response is at a high application level that doen't deep
enough for the raw HTTP communication. For your scenario, you may consider
some IIS isapi filter solution as it can help much more control over the
underlying http communication.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

=============== =============== =============== =====

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no
rights.

May 28 '07 #5
Hi Michael,

Yes, most url length or some non-http specific features will be defined by
client browser. So for this problem, you've also tested it on other
browsers? Also, you can post in some IE general discussion newsgroup for
some further idea on this.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

May 30 '07 #6

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

Similar topics

2
2503
by: mike_j | last post by:
I'm writing a download script in php. This script sends files using echo in order to limit download speed. My script has to do something after connection abort. Everything is ok unless client pauses downloading. I'm using ignore_user_abort() and I'm checking connection_status() while sending a file. When the user aborts connection, my loop breaks and script finishes its job. But if the user pauses connection, the script still sends a...
0
1791
by: mike_j | last post by:
I'm writing a download script in php. This script sends files using echo in order to limit download speed. My script has to do something after connection abort. Everything is ok unless client pauses downloading. I'm using ignore_user_abort() and I'm checking connection_status() while sending a file. When the user aborts connection, my loop breaks and script finishes its job. But if the user pauses connection, the script still sends a...
7
3293
by: Morris | last post by:
I want to abort a running thread, so I call MyThread.abort() function. My problem is this thread runs "almost" like a while(true) loop and I don't want the Abort() function interrupts the thread at any point in the thread. In fact, I have a section of code needs to be "protected" from being interrupted. How can I make sure Abort() will not land anywhere winthin this block? In other words, the Abort() must wait until this block of code is done...
20
3036
by: Doug Thews | last post by:
I ran into an interesting re-pain delay after calling the Abort() method on a thread, but it only happens the very first time I call it. Every time afterward, there is no delay. I've got a delegate inside the UI that I call to update the progress meter. I use the Suspend() and Abort() methods based on button events. I can watch the progress meter increase just fine when the thread is running. When I select Start, I enable the Cancel...
18
5862
by: Urs Vogel | last post by:
Hi I wrote an application server (a remoting sinlgeton), where processes must be stopped in very rare cases, done thru a Thread.Abort(). Occasionally, and only after a Thread.Abort(), this component becomes instabile, throwing a Windows like error (access violation on 0x00000002), not an framework exception. The component and all of its subcomponents are 100% managed code. What could go wrong with Thread.Abort()? Thanks for any hints.
13
2437
by: Shailesh Humbad | last post by:
Here is an advanced PHP question. Can anyone think of a way to detect the number of bytes written to output when a script is aborted? I am sending a large file to the client, and I want to record how many bytes are actually sent. I can detect abort of the script using a shutdown handler. In the shutdown handler, I tried ob_get_length, but it returns false. I tried to read the server's log file, but it is does not contain the...
7
1476
by: IsRaEl | last post by:
Hello I have a thread that start a really boring process of upload and download a bunch of 1kb files on a server. Since my internet connection SUCKS, during the download process, the class that do the download just freeze..and, since it is ona thread, the service just go on... every time a download starts i save that in a global variable... using that variable, i did some code that detects if the thread is
6
2945
by: mehdi | last post by:
Hi folks, You know, the Thread class has got a method named Abort which according to the msdn: "Raises a ThreadAbortException in the thread on which it is invoked, to begin the process of terminating the thread. Calling this method usually terminates the thread." I've had a long discussion with someone on not to use the mentioned method unless under the most extreme cases. I believe that it's
0
5897
by: kuguy | last post by:
Hi all, I'm new to the forums, so I hope this isn't in the wrong place... I have that "Software caused connection abort: socket write error" exception error that i've never meet before. Basically what im trying to do is the following: - a client connect to a server using sslsocket. - server receive the connection and reply with the first part of the data and keep the connection open. - then client receive the reply and request for...
0
10438
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
10214
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
10001
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
9042
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
7540
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...
0
6780
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();...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3727
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2920
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.