Uri Property

Gets the Uniform Resource Identifier (URI) of the download request.

Cannot be used in XAML.
value = downloaderObject.Uri

Property Value


A string value that corresponds to the URI of the Downloader object request.

This property is read-only. The default value is an empty string.


When you invoke the Send method of the Downloader object, you specify a uri parameter that represents the data to be downloaded. The Uri property corresponds to the value of the uri parameter of the Send method. The Uri property enables you to differentiate downloaded content when you use the share DownloadProgressChanged or Completed event handler functions for multiple Downloader object requests.

Note   The Uri value must reference a file that comes from the same site of origin as the instantiated Silverlight plug-in. Usually this is accomplished by specifying a relative URI.


The following JavaScript example shows how to use the Uri property in a Completed event handler function to determine what actions to take for the returned value of the GetResponseText method invocations. Since the downloaded content does not represent packaged content, the part parameter for GetResponseText must be set to an empty string. Notice that the Status property value is used to determine whether the content was successfully downloaded:

// Event handler for the Completed event.
function onCompleted(sender, eventArgs)
    // If HTTP status code indicates "OK", determine action based on URI property.
    if (sender.uri == "OK_button.js")
        // Evaluate JavaScript code -- causes code to be memory-resident.
    if (sender.uri == "OK_button.xaml")
        // Retrieve downloaded XAML content.
        var xamlFragment = sender.ResponseText;
        // Create the objects from the XAML content.
        var plugin = sender.getHost();
        var button = plugin.content.createFromXaml(xamlFragment);
        // Add downloaded XAML content to the root Canvas of the plug-in.
        var rootCanvas = sender.findName("rootCanvas");

Applies To


See Also

Using a Downloader Object