DownloadFailed Event

Occurs when an attempted download request completes with no content.

XAML
Cannot be used in XAML.
Scripting
[token = ]downloaderObject.AddEventListener("DownloadFailed", eventhandlerFunction)

AddEventListener Parameters

downloaderObject

object

A particular Downloader object.

token

integer

A token that is returned from the function, which you can optionally retain as a variable. If you intend to call RemoveEventListener to remove the handler, you will need this token.

eventhandlerFunction

object

The name of your event handler function as it is defined in script. When used as an AddEventListener parameter, quotes around the function name are not required. See Remarks.

Event Handler Parameters

sender

object

Identifies the object that invoked the event.

eventArgs

object

This parameter is always set to null.

Remarks

The DownloadFailed event occurs after a download request has completed and returned no content, asynchonous to a call to the Send method of the Downloader object. The Status and StatusText properties reflect the HTTP status code values for the failed download request.

You can also add handlers in script using a quoted string for the event handler name:

downloaderObject.AddEventListener("DownloadFailed", "eventhandlerFunction")

This syntax also returns a token; however, the token is not an absolute requirement for removing the handler, in cases where the handler was added by using a quoted string. For details, see RemoveEventListener.

The DownloadFailed event occurs after you send a download request, and when a download request returns with no content. Typically you use a Completed event handler to access the response text that is available on the Downloader object. If you are downloading from a URI that has a chance of failing, you would then also add an event handler for the DownloadFailed event to your application and write the appropriate code steps that might be necessary to account for the content not being available.

For more information on Silverlight errors and error handling, see Silverlight Error Handling. For a list of error messages associated with this event, see Error Messages.

Applies To

Downloader

See Also

Error Handling
Error Messages
Using a Downloader Object
DownloadProgressChanged
Status
Completed
StatusText