Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Uri.Uri(String) constructor

Initializes a new Uri object from the specified Uniform Resource Identifier (URI) string. Initializing the Uri also parses the string and populates the Uri properties that represent URI components.

Syntax


var uri = new Windows.Foundation.Uri(uri);

Parameters

uri

Type: String [JavaScript] | Platform::String [C++]

The string from which the new Uri object is created.

Examples

This example creates a Uri that uses the http: protocol to access a website.


// The URI string
var uriToLaunch = "http://www.bing.com";

// Create a Uri object from the URI string 
var uri = new Windows.Foundation.Uri(uriToLaunch);

This example creates a Uri that uses the ms-appx: protocol to access an image file in the app package (under an /images folder as defined in the package structure).


// The URI string
var uriImage = "ms-appx:///images/SecondaryTileDefault-sdk.png";

// Create a Uri object from the URI string
var uri = new Windows.Foundation.Uri(uriImage);

This example creates a Uri that uses the ms-appdata: protocol to access a file in local app data store for your app.


// The URI string
var uriFile = "ms-appdata:///local/file.ext";

// Create a Uri object from the URI string
var uri = new Windows.Foundation.Uri(uriFile);

Requirements (device family)

Device family

Universal

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.Foundation
Windows::Foundation [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (operating system)

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8

Namespace

Windows.Foundation
Windows::Foundation [C++]

Metadata

Windows.winmd

See also

Uri
Uri(String, String)

 

 

Show:
© 2015 Microsoft