I built a file upload control in Silverlight that uploads files to the web server. I use a custom HTTP Handler to handle the upload.

What would be the best practice to detect a whether a client has disconnected prior to finishing the upload?


I think this could go under C# and windows development as well.

if client prior to finish upload we can not do anything

The only thing I could think of is a manual timeout... using a timer of some form, but I don't know how efficient that would be.

Do you have a way of detecting how much data was sent and how much was received?

Perhaps try using some sort of timer and check back on file upload progress every x seconds/minutes. If it stops after a certain period of time and the full amount of data has not been transferred, then perform whatever logic you desire.

That's kind what I was thinking, however, I was trying to see if there are any alternatives. It's not looking likely.

Something like that wouldn't really work because of the disconnected nature of the internet. HTTP is stateless.