Uri Class
Analyse des identificateurs URI (Uniform Resource Identifiers).
.NET: Ce type apparaît sous forme de System.Uri.
Syntaxe
var uri = new Windows.Foundation.Uri(string); var uri = new Windows.Foundation.Uri(string, string);
Attributs
- ActivatableAttribute(Windows.Foundation.IUriRuntimeClassFactory, NTDDI_WIN8)
- DualApiPartitionAttribute()
- MarshalingBehaviorAttribute(Agile)
- StaticAttribute(Windows.Foundation.IUriEscapeStatics, NTDDI_WIN8)
- ThreadingAttribute(Both)
- VersionAttribute(NTDDI_WIN8)
Membres
UriClasse comporte les types de membres suivants :
Constructeurs
UriClasse comporte les constructeurs suivants.
| Constructeur | Description |
|---|---|
| Uri(String) | Creates a Uniform Resource Identifier (URI) from the specified string. |
| Uri(String, String) | Creates a Uniform Resource Identifier (URI) by combining a base Uniform Resource Identifier (URI) and a relative Uniform Resource Identifier (URI). |
Méthodes
The Uri Classe comporte les méthodes suivantes. Avec C#, Visual Basic et C++, il hérite également des méthodes de Object Classe.
| Méthode | Description |
|---|---|
| CombineUri | Adds the specified Uniform Resource Identifier (URI) to the current Uniform Resource Identifier (URI). |
| Equals(Uri) | Determines whether the specified Uniform Resource Identifier (URI) is equal to the current Uniform Resource Identifier (URI). |
| EscapeComponent | Converts a URI string to its escaped representation. |
| UnescapeComponent | Converts the specified string by replacing any escape sequences with their unescaped representation. |
Propriétés
Le UriClasse contient les propriétés suivantes.
| Propriété | Type d’accès | Description |
|---|---|---|
| en lecture seule | Gets a fully canonicalized RFC-complaint representation of the current URI. | |
| en lecture seule | Gets the entire, non-canonical IRI. | |
| en lecture seule | Gets the decoded unicode characters that make up the current URI. | |
| en lecture seule | Gets a representation of the IRI that can be used for display purposes. | |
| en lecture seule | Gets the domain name, including top-level domain, from a Uniform Resource Identifier (URI). | |
| en lecture seule | Gets the file name extension of the resource that is referenced in the Uniform Resource Identifier (URI). | |
| en lecture seule | Gets the text following a fragment marker (#), including the fragment marker itself. | |
| en lecture seule | Gets the fully qualified domain name. | |
| en lecture seule | Gets the password, as parsed from a Uniform Resource Identifier (URI). | |
| en lecture seule | Gets the path and resource name. | |
| en lecture seule | Gets the port number. | |
| en lecture seule | Gets the query string. | |
| en lecture seule | Gets a parsed URL query string. | |
| en lecture seule | Gets the entire original Uniform Resource Identifier (URI) string. | |
| en lecture seule | Gets the protocol scheme name. | |
| en lecture seule | Gets a value that indicates whether the Uniform Resource Identifier (URI) is not well-formed. | |
| en lecture seule | Gets the user name as parsed from a Uniform Resource Identifier (URI). |
Remarques
Lors de la génération des applications Windows Store avec Microsoft .NET Framework, cette classe est masquée et les développeurs doivent utiliser la classe System.Uri qui utilise la norme RFC 3987 pour encoder et décoder les URI. La classe Uri n'encode pas en pourcentage les caractères non ASCII dans file:// URI et interprète l'encodage en pourcentage à l'aide de la page de codes actuelle de l'utilisateur.
Voici une répartition des parties d'un exemple d'URI :
scheme://username:password@host:port/path.extension?query#fragment
Par exemple :
ftp://user:password@ftp.microsoft.com:8080/path/bin/file.asp?q=query#fragment
Dans cet exemple :
- scheme a la valeur ftp.
- host a la valeur ftp.microsoft.com.
- domain a la valeur microsoft.com (un sous-ensemble de host)
- port a la valeur 8080.
- extension a la valeur asp.
Exemples
Cet exemple crée un URI qui utilise le protocole HTTP pour accéder à un site Web.
// The URI string var uriToLaunch = "http://www.bing.com"; // Create a Uri object from the URI string var uri = new Windows.Foundation.Uri(uriToLaunch);
Cet exemple crée un URI qui utilise le protocole ms-appx pour accéder à un fichier image dans le package d'application.
// 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);
Cet exemple crée un URI qui utilise le protocole ms-appdata pour accéder à un fichier dans le magasin de données local de votre application.
// 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);
Configuration requise
|
Client minimal pris en charge | Windows 8 [Applications du Windows Store, applications de bureau] |
|---|---|
|
Serveur minimal pris en charge | Windows Server 2012 [Applications du Windows Store, applications de bureau] |
|
Téléphone minimal pris en charge | Windows Phone 8 |
|
Espace de noms |
|
|
Métadonnées |
|
Voir aussi
