xtd 0.2.0
Loading...
Searching...
No Matches

◆ authority()

xtd::string xtd::uri::authority ( ) const

Gets the Domain Name System (DNS) host name or IP address and the port number for a server.

Returns
The authority component of the URI represented by this instance.
Exceptions
xtd::invalid_operation_exceptionThis instance represents a relative URI, and this property is valid only for absolute URIs.
Examples
The following example writes the host name (www.contoso.com) and port number (8080) of the server to the console.
auto base_uri = uri("http://www.contoso.com:8080/");
auto my_uri = uri(base_uri,"shownew.htm?date=today");
console::write_line(my_uri.authority());
static void write_line()
Writes the current line terminator to the standard output stream using the specified format informati...
uri()=default
Initializes a new instance of the xtd::uri class.
Remarks
The xtd::uri::authority property is typically a server DNS host name or IP address. This property might include the service port number if it differs from the default port for the URI. If the xtd::uri::authority component contains reserved characters, these are escaped in the string value returned by this property.