views:

48

answers:

1

Hi,

I am developing a web application in .Net 2005 in C#. Here there is a provision that allows the user to download the file from our server which will be mostly .doc files. So I am using Response.TransmitFile and content-disposition header method to write the file to the client.

My current requirement is to identify the status of the file being downloaded. If the file download is success/ failure then I have to show a status message in my web page.

I am not aware of any method that can do this kind of action in ASP.Net. So any help would be appreciated. The main problem is that the user can use any external Download Manager tools to do the download process and he can close my application from his browser and continue the download process at a later time.

Edit

Success in the sense that I have to identify whether all the bytes were downloaded or not.

Thanks

+2  A: 

I'm not certain that there is anything you can do to measure download success. The client has issued a request, which you have responded to with a 200 status and with content. At best, you could determine whether all the content was sent. You cannot know what the client did with the content.

As an extreme example, how could you know on the server if the client received all of your content, and then crashed the computer? How could you know that all content was received and then the file was opened in Word? As far as the server is concerned, these two events are the same.

John Saunders
+1 for the nice answer. So the answer to my question would be "no", right?
rahul
Right. It's just not possible from the server side. OTOH, maybe if you did the request through Ajax, you'd be able to measure "success" and update the page on the client side to indicate success. I still don't know how you'd measure success, or why?
John Saunders
Is there a way this can be done by using a flash plugin or something like that?
rahul
I have no idea. Again, the important thing will be to come up with a consistent definition of what "success" means. Does it mean all the bytes received? That the file was opened? That Word displayed it? That the user read it? That the user understood what they read? Pick a definition, and you can get help in implementing that definition.
John Saunders
"Success" means whether all the bytes were received or not
rahul

related questions