Current location - Quotes Website - Personality signature - How to check windows user uri
How to check windows user uri

Windows Runtime methods only accept absolute URIs. If you pass a relative URI to a Windows Runtime method, an ArgumentException exception will be thrown. Here's why: When using the Windows Runtime in .NET Framework code, the Windows.Foundation.Uri class appears as a Uri in Intellisense. The Uri class allows relative URIs, but the Windows.Foundation.Uri class does not. This also applies to methods exposed in Windows Runtime components. If the component exposes a method that receives a URI, the signature in the code contains the Uri. However, for users of the component, the signature contains Windows.Foundation.Uri. The URI passed to the component must be an absolute URI.

This topic demonstrates how to detect an absolute URI and create one when referencing a resource in an app package.

Detecting and using absolute URIs

Use the Uri.IsAbsoluteUri property to ensure that the URI is absolute before passing it to the Windows Runtime. Using this property is more efficient than catching and handling ArgumentException exceptions.

Using absolute URIs for resources in an app bundle

If you want to specify a URI for a resource contained in an app bundle, you can create it using the ms-appx or ms-appx-web scheme Absolute URI.

The following example shows how to use both XAML and code to set the Source property of the WebView control and the Source property of the Image control to include resources in a folder named Pages.

C#

VB

private void Button_Click_1(object sender, RoutedEventArgs e)

{

webview1. Source = new Uri("ms-appx-web:///Pages/HTMLPage2.html", UriKind.Absolute);

}

XAML

VerticalAlignment="Top" Width=" 310" Margin="472,57,553,0"

Source="ms-appx-web:///Pages/HTMLPage1.html"/>