Try our conversational search powered by Generative AI!

Class HostDefinition

Contains information about a host such as host name and a potential language mapping for the host name.

Inheritance
System.Object
HostDefinition
Implements
System.IEquatable<HostDefinition>
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Web
Assembly: EPiServer.dll
Version: 11.20.7
Syntax
[EPiServerDataStore(AutomaticallyRemapStore = true)]
public class HostDefinition : IReadOnly<HostDefinition>, IReadOnly, IEquatable<HostDefinition>

Constructors

HostDefinition()

Declaration
public HostDefinition()

Fields

WildcardHostName

The wild card host name that is used to map unmapped hosts.

Declaration
public const string WildcardHostName = "*"
Field Value
Type Description
System.String

Properties

Authority

Exposes the authority part of the host

Declaration
public UriAuthority Authority { get; }
Property Value
Type Description
UriAuthority

IsReadOnly

Indicates whether the current object instance is read-only.

Declaration
public bool IsReadOnly { get; }
Property Value
Type Description
System.Boolean

Language

Gets or sets the language that is mapped to the current host.

Declaration
public virtual CultureInfo Language { get; set; }
Property Value
Type Description
System.Globalization.CultureInfo
Remarks

If there is no language mapped for the host it returns null.

Name

Gets or sets the name of the host. Must be a valid URI authority.

Declaration
public virtual string Name { get; set; }
Property Value
Type Description
System.String

Site

This should be set internally when saving or loading the site. Needed to create a full URL for the time being.

Declaration
public SiteDefinition Site { get; }
Property Value
Type Description
SiteDefinition

Type

Gets or sets what type of behavior that this host should have.

Declaration
public virtual HostDefinitionType Type { get; set; }
Property Value
Type Description
HostDefinitionType
Remarks

A SiteDefinition can only have a maximum of one primary host and one edit host per language. It can also not only contain hosts set to redirect, These rules will be validated when the SiteDefinition is saved.

Url

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice.

Declaration
public virtual Uri Url { get; }
Property Value
Type Description
System.Uri

UseSecureConnection

Gets or sets a value indicating whether HTTPS should be preferred when generating links to this host.

Declaration
public virtual bool? UseSecureConnection { get; set; }
Property Value
Type Description
System.Nullable<System.Boolean>
Remarks

If not set, any generated links to the host will use the same scheme as the URL of the site containing this host.

Methods

CreateWritableClone()

Declaration
public virtual HostDefinition CreateWritableClone()
Returns
Type Description
HostDefinition

Equals(HostDefinition)

Declaration
public bool Equals(HostDefinition other)
Parameters
Type Name Description
HostDefinition other
Returns
Type Description
System.Boolean

Equals(Object)

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
System.Object obj
Returns
Type Description
System.Boolean
Overrides
System.Object.Equals(System.Object)

GetHashCode()

Declaration
public override int GetHashCode()
Returns
Type Description
System.Int32
Overrides
System.Object.GetHashCode()

IsWildcardHost()

Determines whether this instance is mapped to any host.

Declaration
public bool IsWildcardHost()
Returns
Type Description
System.Boolean

true if this HostDefinition is a wildcard host; otherwise false.

IsWildcardHost(String)

Determines whether this instance is a wildcard host.

Declaration
public static bool IsWildcardHost(string hostName)
Parameters
Type Name Description
System.String hostName

The hostname to check.

Returns
Type Description
System.Boolean

true if this HostDefinition is a wildcard host; otherwise false.

MakeReadOnly()

Changes the object instance into a read-only object.

Declaration
public void MakeReadOnly()
Remarks

After calling this method, any attempt to change the object instance or any contained object will generate a System.NotSupportedException. I.e. the semantics is "deep read-only".

Note! After setting an object to read-only it is not possible to revert back to read-write mode. You will have to call the CreateWritableClone method to get a copy that can be modified.

ThrowIfReadOnly()

Throws an exception if the current instance is read-only.

Declaration
protected void ThrowIfReadOnly()

Explicit Interface Implementations

IReadOnly.CreateWritableClone()

Creates a writable copy of the current object.

Declaration
object IReadOnly.CreateWritableClone()
Returns
Type Description
System.Object

A writable copy of the current object.

Remarks

The cloning is a deep-copy.

Implements

System.IEquatable<T>

Extension Methods