Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can use <a href="https://docs.microsoft.com/en-gb/dotnet/api/system.uri" rel="nofollow noreferrer">URI</a> class to get the host name.</p> <pre><code>var uri = new Uri("http://www.example.com/mypage/default.aspx"); var host = uri.Host; </code></pre> <p><strong>Edit</strong> You can use <a href="https://docs.microsoft.com/en-gb/dotnet/api/system.uri.scheme" rel="nofollow noreferrer">uri.Scheme</a> and <a href="https://docs.microsoft.com/en-gb/dotnet/api/system.uri.port" rel="nofollow noreferrer">uri.Port</a> to get the .Scheme e.g. (http, ftp) and .Port to get the port number like (8080)</p> <pre><code>string host = uri.Host; string scheme = uri.Scheme; int port = uri.Port; </code></pre> <p>You can use <a href="https://docs.microsoft.com/en-gb/dotnet/api/system.uri.getleftpart" rel="nofollow noreferrer">Uri.GetLeftPart</a> to get the base URL.</p> <blockquote> <p>The <a href="https://docs.microsoft.com/en-gb/dotnet/api/system.uri.getleftpart" rel="nofollow noreferrer">GetLeftPart</a> method returns a string containing the leftmost portion of the URI string, ending with the portion specified by part.</p> </blockquote> <pre><code>var uri = new Uri("http://www.example.com/mypage/default.aspx"); var baseUri = uri.GetLeftPart(System.UriPartial.Authority); </code></pre> <p>The following examples show a URI and the results of calling GetLeftPart with Scheme, Authority, Path, or Query, <a href="https://docs.microsoft.com/en-gb/dotnet/api/system.uri.getleftpart" rel="nofollow noreferrer">MSDN</a>. <a href="https://i.stack.imgur.com/PTYP6.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PTYP6.jpg" alt="enter image description here"></a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload