What is a URI? Understanding URI, URL, and URN

 What is a URI? Understanding URI, URL, and URN
In this article [Show more]

    What is a URI?

    A Uniform Resource Identifier (URI) is a string of characters used to identify a resource either on the internet or within a specific namespace. URIs are essential for locating and interacting with resources in various systems, including web applications and APIs.

    URL

    A Uniform Resource Locator (URL) is a specific type of URI that provides the means to locate a resource on the internet. It includes the address of the resource, such as the domain name and possibly the path to the resource.

    Example:

    using System;
    
    class Program
    {
        static void Main()
        {
            var url = new Uri("https://www.example.com/path/to/resource");
            Console.WriteLine($"URL: {url}");
        }
    }
    

    URI vs URL

    While all URLs are URIs, not all URIs are URLs. A URL specifies the location of a resource on the web, while a URI is a broader term that can include both URLs and Uniform Resource Names (URNs).

    Example:

    using System;
    
    class Program
    {
        static void Main()
        {
            var url = new Uri("https://www.example.com");
            var uri = new Uri("urn:isbn:0451450523");
            
            Console.WriteLine($"URL: {url}");
            Console.WriteLine($"URI: {uri}");
        }
    }
    

    URIs in Medical Context

    In medical contexts, URIs often stand for Upper Respiratory Infections. This usage of "URI" is unrelated to the web or digital resource identification.

    URI in Medical Terms

    When referring to Upper Respiratory Infections, "URI" is used to describe infections that affect the upper respiratory tract, including the nose, throat, and sinuses.

    URI vs URL Full Form

    • URI: Uniform Resource Identifier
    • URL: Uniform Resource Locator

    URI vs URL vs URN

    • URI: A general term for identifiers that can include URLs and URNs.
    • URL: A URI that provides a means to locate a resource on the web.
    • URN: Uniform Resource Name, a type of URI that names a resource without providing its location.

    Example:

    using System;
    
    class Program
    {
        static void Main()
        {
            var urn = new Uri("urn:example:resource");
            Console.WriteLine($"URN: {urn}");
        }
    }
    

    URI vs URL Examples

    • URL Example: https://www.example.com/index.html
    • URN Example: urn:example:12345

    C# Code Example:

    using System;
    
    class Program
    {
        static void Main()
        {
            var url = new Uri("https://www.example.com");
            var urn = new Uri("urn:example:12345");
    
            Console.WriteLine($"URL: {url}");
            Console.WriteLine($"URN: {urn}");
        }
    }
    

    S3 URI vs URL

    Amazon S3 URIs can be either URLs or URNs depending on the format. A URL might look like https://s3.amazonaws.com/bucket-name/object-key, while a URN might be used in contexts where the exact location is not needed but the name is.

    Example:

    using System;
    
    class Program
    {
        static void Main()
        {
            var s3Url = new Uri("https://s3.amazonaws.com/bucket-name/object-key");
            Console.WriteLine($"S3 URL: {s3Url}");
        }
    }
    

    What is a URI Full Form?

    The full form of URI is Uniform Resource Identifier. It is a generic term that includes both URLs and URNs, which are specific types of URIs.

    C# Code Example:

    using System;
    
    class Program
    {
        static void Main()
        {
            var uri = new Uri("https://www.example.com");
            Console.WriteLine($"URI: {uri}");
        }
    }
    

     

     


    Author Information
    • Author: Ehsan Babaei

    Send Comment



    Comments