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

Detect File is Completely Download by Client

RC
how to detect file is completely downloaded from client by following code?

<%@ Page language="C#" debug="true" %>
<script language="C#" runat="server">
private void Page_Load(object sender, System.EventArgs e) {
Response.ContentType="application/zip";
Response.AppendHeader("Content-Disposition","attachment;
filename=myzipfile.zip");
Response.WriteFile(@"c:\inetpub\wwwroot\myzipfile. zip");
Response.Flush();
}
</script>
Nov 19 '05 #1
5 3009
You can't. Once the file is sent, you have no way of knowing how long it
travels over the web, or how slow the other person's connection is, or how
long it takes. Once you send it, your job is done.

"RC" <rc@gmail.com> wrote in message
news:eX**************@TK2MSFTNGP09.phx.gbl...
how to detect file is completely downloaded from client by following code?

<%@ Page language="C#" debug="true" %>
<script language="C#" runat="server">
private void Page_Load(object sender, System.EventArgs e) {
Response.ContentType="application/zip";
Response.AppendHeader("Content-Disposition","attachment;
filename=myzipfile.zip");
Response.WriteFile(@"c:\inetpub\wwwroot\myzipfile. zip");
Response.Flush();
}
</script>

Nov 19 '05 #2
"Marina" <so*****@nospam.com> wrote in message
news:Or**************@TK2MSFTNGP12.phx.gbl...
You can't. Once the file is sent, you have no way of knowing how long it
travels over the web, or how slow the other person's connection is, or how
long it takes. Once you send it, your job is done.

Um, wrong, you don't just chuck a file onto the Internet and hope it reaches
it's destination. A stateful connection takes place.

There is a solution. You could send it about 512 bytes a time with
Response.BinaryWrite / Response.Flush and check for
Response.IsClientConnected between each block. If that is ever false, the
connection has dropped and the user doesn't have their file.

--
Matt
"RC" <rc@gmail.com> wrote in message
news:eX**************@TK2MSFTNGP09.phx.gbl...
how to detect file is completely downloaded from client by following code?
<%@ Page language="C#" debug="true" %>
<script language="C#" runat="server">
private void Page_Load(object sender, System.EventArgs e) {
Response.ContentType="application/zip";
Response.AppendHeader("Content-Disposition","attachment;
filename=myzipfile.zip");
Response.WriteFile(@"c:\inetpub\wwwroot\myzipfile. zip");
Response.Flush();
}
</script>


Nov 19 '05 #3
His code wasn't doing that. Presumably he wanted to know if there was a way
to check that after executing that piece of code. He's got to rewrite that
block of code first.

"Matt Dockerty" <Ps reply to group> wrote in message
news:eE**************@TK2MSFTNGP15.phx.gbl...
"Marina" <so*****@nospam.com> wrote in message
news:Or**************@TK2MSFTNGP12.phx.gbl...
You can't. Once the file is sent, you have no way of knowing how long it
travels over the web, or how slow the other person's connection is, or
how
long it takes. Once you send it, your job is done.


Um, wrong, you don't just chuck a file onto the Internet and hope it
reaches
it's destination. A stateful connection takes place.

There is a solution. You could send it about 512 bytes a time with
Response.BinaryWrite / Response.Flush and check for
Response.IsClientConnected between each block. If that is ever false, the
connection has dropped and the user doesn't have their file.

--
Matt
"RC" <rc@gmail.com> wrote in message
news:eX**************@TK2MSFTNGP09.phx.gbl...
> how to detect file is completely downloaded from client by following code? >
> <%@ Page language="C#" debug="true" %>
> <script language="C#" runat="server">
> private void Page_Load(object sender, System.EventArgs e) {
> Response.ContentType="application/zip";
> Response.AppendHeader("Content-Disposition","attachment;
> filename=myzipfile.zip");
> Response.WriteFile(@"c:\inetpub\wwwroot\myzipfile. zip");
> Response.Flush();
> }
> </script>
>
>



Nov 19 '05 #4
this has the minor hole, that the last write may not be received by the
client even though the server successfully sent it..

-- bruce (sqlwork.com)
"Matt Dockerty" <Ps reply to group> wrote in message
news:eE**************@TK2MSFTNGP15.phx.gbl...
"Marina" <so*****@nospam.com> wrote in message
news:Or**************@TK2MSFTNGP12.phx.gbl...
You can't. Once the file is sent, you have no way of knowing how long it
travels over the web, or how slow the other person's connection is, or
how
long it takes. Once you send it, your job is done.


Um, wrong, you don't just chuck a file onto the Internet and hope it
reaches
it's destination. A stateful connection takes place.

There is a solution. You could send it about 512 bytes a time with
Response.BinaryWrite / Response.Flush and check for
Response.IsClientConnected between each block. If that is ever false, the
connection has dropped and the user doesn't have their file.

--
Matt
"RC" <rc@gmail.com> wrote in message
news:eX**************@TK2MSFTNGP09.phx.gbl...
> how to detect file is completely downloaded from client by following code? >
> <%@ Page language="C#" debug="true" %>
> <script language="C#" runat="server">
> private void Page_Load(object sender, System.EventArgs e) {
> Response.ContentType="application/zip";
> Response.AppendHeader("Content-Disposition","attachment;
> filename=myzipfile.zip");
> Response.WriteFile(@"c:\inetpub\wwwroot\myzipfile. zip");
> Response.Flush();
> }
> </script>
>
>



Nov 19 '05 #5
"Bruce Barker" <br******************@safeco.com> wrote in message
news:ei**************@TK2MSFTNGP09.phx.gbl...
this has the minor hole, that the last write may not be received by the
client even though the server successfully sent it..
HTTP 1.1 has persistent connections where the connection remains open for a
little while after the file is recieved in case the client wants something
else from the server. Unless the client needs to talk in HTTP 1.0 (extremely
rare) or you're explicitly sending a 'Connection: close' header the last
block will be detected too.

-- bruce (sqlwork.com)
"Matt Dockerty" <Ps reply to group> wrote in message
news:eE**************@TK2MSFTNGP15.phx.gbl...
"Marina" <so*****@nospam.com> wrote in message
news:Or**************@TK2MSFTNGP12.phx.gbl...
You can't. Once the file is sent, you have no way of knowing how long it travels over the web, or how slow the other person's connection is, or

<snip>
Nov 19 '05 #6

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

Similar topics

2
by: Pedro Fonseca | last post by:
Greetings! In my PHP website I'm trying to raise a File Download dialog directly in a WindowsCE IE client with the following code: header( "Content-Type: application/octet-stream\n" );...
4
by: Billy Jacobs | last post by:
Is there a way to download multiple files from a server? If not then: How do I zip up multiple files using the .net classes in vb? Thanks Billy Jacobs
1
by: Vasu | last post by:
Hi, I have a requirement to download a file from the web site using a client tool. Iam writing a C# program to download using WebRequest, HttpRequest, WebResponse and so on. The problem...
9
by: Glen | last post by:
I'm writing a console utility to download specific files from web sites based on the command line options. In most cases, I can trap the 404 error when the file isn't available because the...
1
by: Roy | last post by:
Hi, I have a problem that I have been working with for a while. I need to be able from server side (asp.net) to detect that the file i'm streaming down to the client is saved...
13
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...
22
by: petermichaux | last post by:
Hi, I'm curious about server load and download time if I use one big javascript file or break it into several smaller ones. Which is better? (Please think of this as the first time the scripts...
0
by: ar | last post by:
Hello, In IE I disable "Automatic prompting for file downloads" which causes the IE information bar to show up when I try to push a file download from an iframe. I want to keep this behaviour. ...
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...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.