Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Uri
Key
M11
M12
M21
M22
Tag
Uri
X1
X2
Y1
Y2
Collapse the table of content
Expand the table of content

Uri

Silverlight

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

value = downloaderObject.Uri

Type: string

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.

None. Downloader does not exist in the managed API. Generally you can use WebClient for downloads, which provides equivalent functionality.

When you invoke the Open 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 Open method. The Uri property provides a way to differentiate downloaded content if you use shared DownloadProgressChanged or Completed event handler functions for multiple Downloader object requests.

NoteNote:

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. Because the downloaded content does not represent packaged content, the part parameter for GetResponseText must be set to an empty string.

// 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.
        eval(sender.ResponseText);
    }

    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");
        rootCanvas.children.add(button);
    }
}

Community Additions

ADD
Show:
© 2015 Microsoft