Helpful Information
 
 
Category: ASP Programming
Download time

I don't know if this is possible, but does anybody know whether you can determine how long a file took to download. I want to be able to log how long a download took. Any help would be appreciated.

no way to do this in ASP nor any other server-side language. :(

but you might be able to do it writing a java-download-manager. - donīt try, imho itīs not worth the effort...

Cool thanks

Whats your definition of a download and how accurate do you have to be?

I've got a file that can be downloaded off of my site. I would like to determine how long it took from the time they said yes to the time it finished downloading onto their computer. Ideally it should be fairly accurate.

I'm pretty sure you can do it like this.

instead of using a <a href="filename.ext">download</a>

use an asp ie. download.asp?file=filename.ext file that uses a filesystem object to open the said file using a binary read, set the content type to the correct binary type (a little investigqtion may be needed here) instead of text/html

Then serve the file to them with a response.binarywrite

You can get the current time before you start sending and after you have finished.
You may want to turn buffering off to get a better reading although that may slow down the download.

Also you might try using Response.IsClientConnected to get a more acurate picture of when they finished recieving as aposed to when you stopped sending it. There may or may not be a difference.

ps. be sure you dont le't any filename appear in the query string, make sure you sanity check it against a list of valid downloads, or anybody could get anthying from you webserver!

Thanks, I'll play around with those ideas.

squib, please forget my post. of course "ngibsonau" is right, you can do it this way. i just didnīt get the idea :o

not a problem :)

finally had a chance to play, but I'm not quite there yet...
I can get the start time no problem, but am still having trouble getting the end time. Here's the code I'm using for my proof of concept...


option explicit

Dim oConn,oRS,sSQL

sSQL = "Insert into AD00_StartEnd (StartTime) Values ('" & now() & "')"

set oConn = server.CreateObject ("ADODB.Connection")
oConn.Open Application("DLTime_ConnectionString")
set oRS = oConn.Execute (sSQL)
oConn.Close
set oConn = nothing

do
if not (Response.IsClientConnected) then
sSQL = "Insert into AD00_StartEnd (EndTime) Values ('" & now() & "')"
Response.Write (sSQL)
set oConn = server.CreateObject ("ADODB.Connection")
oConn.Open Application("DLTime_ConnectionString")
set oRS = oConn.Execute (sSQL)
oConn.Close
set oConn = nothing
exit do
end if
loop


any help would be appreciated. Thanks

Under the IIS panel ..
Log File Browse
Under log file Extended Properties
There is an option to log "Time Taken"

and from the help files
"Time Taken The length of time the action took."

I am not sure what exactly action took mean ... but I thought it might be something you want to test.


but ofcourse this is for personal knowledge ... you seemed to be trying to store it in a DB. I mean this way you will have to actually open the log files and search for the file downloaded and see how long it took. but I thought it is worth mentioning anyways.

I hope this is of any help.

Thanks. Yeah, I'm trying to store the time in a database, so I can get the total time of the download.

Can anyone tell me if this can be done without using asp and an MS server? If so, how would you go about doing it?

Thanks.

The same will work with any server and any server side programming language.
Beware, some servers do output buffering, this will make the numbers be much less accurate for small files. Check the docs in case of problems.

hth,
M.

Hey M,

I'm running redhat with apache 1.13 and PHP 4, Where do I look for the log file to get the time taken?

[edit]
unnecessary flame removed










privacy (GDPR)