HostString HostString HostString HostString Struct

Definition

Represents the host portion of a URI can be used to construct URI's properly formatted and encoded for use in HTTP headers.

public value class HostString : IEquatable<Microsoft::AspNetCore::Http::HostString>
public struct HostString : IEquatable<Microsoft.AspNetCore.Http.HostString>
type HostString = struct
Public Structure HostString
Implements IEquatable(Of HostString)
Inheritance
HostStringHostStringHostStringHostString
Implements

Constructors

HostString(String) HostString(String) HostString(String) HostString(String)

Creates a new HostString without modification. The value should be Unicode rather than punycode, and may have a port. IPv4 and IPv6 addresses are also allowed, and also may have ports.

HostString(String, Int32) HostString(String, Int32) HostString(String, Int32) HostString(String, Int32)

Creates a new HostString from its host and port parts.

Properties

HasValue HasValue HasValue HasValue
Host Host Host Host

Returns the value of the host part of the value. The port is removed if it was present. IPv6 addresses will have brackets added if they are missing.

Port Port Port Port

Returns the value of the port part of the host, or null if none is found.

Value Value Value Value

Returns the original value from the constructor.

Methods

Equals(HostString) Equals(HostString) Equals(HostString) Equals(HostString)

Compares the equality of the Value property, ignoring case.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Compares against the given object only if it is a HostString.

FromUriComponent(String) FromUriComponent(String) FromUriComponent(String) FromUriComponent(String)

Creates a new HostString from the given URI component. Any punycode will be converted to Unicode.

FromUriComponent(Uri) FromUriComponent(Uri) FromUriComponent(Uri) FromUriComponent(Uri)

Creates a new HostString from the host and port of the give Uri instance. Punycode will be converted to Unicode.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Gets a hash code for the value.

MatchesAny(StringSegment, IList<StringSegment>) MatchesAny(StringSegment, IList<StringSegment>) MatchesAny(StringSegment, IList<StringSegment>) MatchesAny(StringSegment, IList<StringSegment>)

Matches the host portion of a host header value against a list of patterns. The host may be the encoded punycode or decoded unicode form so long as the pattern uses the same format.

ToString() ToString() ToString() ToString()

Returns the value as normalized by ToUriComponent().

ToUriComponent() ToUriComponent() ToUriComponent() ToUriComponent()

Returns the value properly formatted and encoded for use in a URI in a HTTP header. Any Unicode is converted to punycode. IPv6 addresses will have brackets added if they are missing.

Operators

Equality(HostString, HostString) Equality(HostString, HostString) Equality(HostString, HostString) Equality(HostString, HostString)

Compares the two instances for equality.

Inequality(HostString, HostString) Inequality(HostString, HostString) Inequality(HostString, HostString) Inequality(HostString, HostString)

Compares the two instances for inequality.

Applies to