Handling disconnections

4 posts, 1 answers
  1. Konstantinos
    Konstantinos avatar
    10 posts
    Member since:
    Sep 2011

    Posted 03 Feb 2012 Link to this post

    Dear Sir/Madam

    I have deployed the Silverlight uploader and it works very well. I have come across one issue though which I need to handle somehow.

    When a user is uploading a file and momentarily loses connection to the Internet (e.g. the wireless signal drops), the upload client displays this exception:

    Handler not found or execution of the handler failed!
    [HttpWebRequest_WebException_RemoteServer] Arguments: NotFound
    [...] etc.

    Is there a way for me to catch this exception and display a more meaningful message instead, either inside your yellow warning icon or by using a popup MessageBox?

    Please note that I have turned the resume functionality of my uploader off.

    Thank you.


    Kind Regards,
    Konstantinos

  2. Answer
    Alex Fidanov
    Admin
    Alex Fidanov avatar
    636 posts

    Posted 08 Feb 2012 Link to this post

    Hello Konstantinos,

    What I would recommend is to handle this scenario with custom code. Once the connection is lost, the upload control would raise the FileUploadFailed event. You can check the error message to be sure that the server is not found and there is a problem with the connection. Then, you can save all of the not uploaded items and re-add then back in the upload as new items in a new uploading session.

    Please let me know if this would be acceptable for you or if you have further question on this approach.

    Regards,
    Alex Fidanov
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. DevCraft banner
  4. Konstantinos
    Konstantinos avatar
    10 posts
    Member since:
    Sep 2011

    Posted 13 Feb 2012 Link to this post

    Hello Alex

    Thank you for your response. I will adjust FileUploadFailed to handle this error as you said. One more question on this: is it possible to make FileUploadFailed wait 1 second and then try to resend the last packet that failed, in case it was just an instant disconnection, in order to avoid stopping the current upload session? Will I have to enable resume in order to achieve this?

    Thanks again.

    Konstantinos
  5. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 16 Feb 2012 Link to this post

    Hi Konstantinos,

    Unfortunately you cannot resume the same upload session as when the server returns "UploadHandler Not Found" error, it means that the current session has already ended. This is why Alex advised you to start a new session with the same files and in the FileUploadFailed event handler you are able to access the files that weren't uploaded during the last unsuccessful upload session.

    All the best,
    Tina Stancheva
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Back to Top