UriIdentifier Class
Represents a Uniform Resource Identifier (URI) for use in certificate trust lists (CTLs).
Namespace: System.Net.Security
Assembly: System (in System.dll)
Syntax
public sealed class UriIdentifier : ICloneable
Inheritance Hierarchy
- Object
- UriIdentifier
Interfaces
- ICloneable
Remarks
The UriIdentifier class is used to represent a URI in a certificate trust list (CTL). CTLs are used to store lists of trusted certificates and are often used in applications that require high security, such as those that use SSL/TLS for secure communication.
This class provides methods for creating, cloning, and comparing URIs. It ensures that URIs are represented in a canonical format, which helps in reliable comparison and identification.
Constructors
| Name | Description |
|---|---|
| UriIdentifier(string uri) | Initializes a new instance of the UriIdentifier class with the specified URI. |
| UriIdentifier(Uri uri) | Initializes a new instance of the UriIdentifier class with the specified Uri object. |
Methods
| Name | Description |
|---|---|
| Clone() | Creates a new object that is a copy of the current instance. |
| Equals(object o) | Determines whether the specified object is equal to the current object. |
| GetHashCode() | Serves as the default hash function. |
| GetType() | Gets the Type of the current instance. |
| ToString() | Returns a string representation of the URI identifier. |
Properties
| Name | Description |
|---|---|
| Uri | Gets the Uri object. |
Examples
The following example demonstrates how to create and use a UriIdentifier object.
using System;
using System.Net.Security;
public class Example
{
public static void Main(string[] args)
{
string uriString = "https://www.example.com/resource";
Uri baseUri = new Uri(uriString);
// Create UriIdentifier from string
UriIdentifier id1 = new UriIdentifier(uriString);
Console.WriteLine($"Created UriIdentifier from string: {id1}");
// Create UriIdentifier from Uri object
UriIdentifier id2 = new UriIdentifier(baseUri);
Console.WriteLine($"Created UriIdentifier from Uri object: {id2}");
// Check for equality
if (id1.Equals(id2))
{
Console.WriteLine("id1 and id2 are equal.");
}
// Clone UriIdentifier
UriIdentifier clonedId = (UriIdentifier)id1.Clone();
Console.WriteLine($"Cloned UriIdentifier: {clonedId}");
// Access the underlying Uri object
Uri actualUri = id2.Uri;
Console.WriteLine($"Underlying Uri: {actualUri.AbsoluteUri}");
}
}
Requirements
Client: Supported in Windows XP Professional with Service Pack 2 and later.
Server: Supported in Windows Server 2003 with Service Pack 1 and later.
.NET Framework Versions: Supported in versions 2.0, 3.5, 4.0, 4.5, 4.6, 4.7, 4.8.
Namespace: Use System.Net.Security
Assembly: System (System.dll)