Try our conversational search powered by Generative AI!

Class UrlSegment

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. This class determines behavior for URL Segments, intended to be used by the UrlRewriter functionality.

Inheritance
System.Object
UrlSegment
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Web.Internal
Assembly: EPiServer.Cms.AspNet.dll
Version: 11.20.7
Syntax
[ServiceConfiguration]
public class UrlSegment

Constructors

UrlSegment(IContentRepository)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Initializes a new instance of the UrlSegment class.

Declaration
public UrlSegment(IContentRepository contentRepository)
Parameters
Type Name Description
IContentRepository contentRepository

Properties

UseLowerCaseSegments

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Gets or sets a value indicating whether url segments should be created in lowercase.

Declaration
[Obsolete("Use configure using UrlSegmentOptions instead")]
public static bool UseLowerCaseSegments { get; set; }
Property Value
Type Description
System.Boolean

true if url segment is created in lowercase; otherwise, false.

Remarks

Default value is true.

Methods

GetContentBySegment(ContentReference, String)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Gets the content by segment.

Declaration
public virtual ContentReference GetContentBySegment(ContentReference parentLink, string urlSegment)
Parameters
Type Name Description
ContentReference parentLink

The parent reference

System.String urlSegment

The URL segment.

Returns
Type Description
ContentReference

GetUniqueURLSegment(IContent)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Gets a friendly URL segment based on the content name and possibly a sequence number. URL Segments may collide within a specific content, i.e. different languageBranches can have the same URL Segment, but sibling nodes may not.

Declaration
[Obsolete("Use configure using IUrlSegmentCreator instead")]
public static string GetUniqueURLSegment(IContent content)
Parameters
Type Name Description
IContent content
Returns
Type Description
System.String

A valid URL segment for the content

Remarks

There is potential for race here, since we don't save the segment once we've built it. The caller should probably lock for the duration.

GetUrlFriendlySegment(String)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Replace illegal chars with suggested replacements

Declaration
[Obsolete("Use configure using IUrlSegmentGenerator instead")]
public static string GetUrlFriendlySegment(string segment)
Parameters
Type Name Description
System.String segment
Returns
Type Description
System.String

VerifyContentHasSegment(ContentReference, String)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Verifies the content has segment.

Declaration
public virtual ContentReference VerifyContentHasSegment(ContentReference contentLink, string urlSegment)
Parameters
Type Name Description
ContentReference contentLink

The content link.

System.String urlSegment

The URL segment.

Returns
Type Description
ContentReference

Events

CreatedUrlSegment

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Occurs when an url segment has been created

Declaration
[Obsolete("Use IUrlSegmentCreator.Creating instead")]
public static event EventHandler<UrlSegmentEventArgs> CreatedUrlSegment
Event Type
Type Description
System.EventHandler<UrlSegmentEventArgs>

CreatingUrlSegment

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Occurs when an url segment is to be created

Declaration
[Obsolete("Use IUrlSegmentCreator.Creating instead")]
public static event EventHandler<UrlSegmentEventArgs> CreatingUrlSegment
Event Type
Type Description
System.EventHandler<UrlSegmentEventArgs>

Extension Methods