Class PermanentLinkUtility
Utility functions for the permanent link functionality
Inheritance
Namespace: EPiServer.Web
Assembly: EPiServer.dll
Version: 12.0.3Syntax
public static class PermanentLinkUtility : Object
Methods
ChangeGuid(String, Guid)
Changes the Guid in a permanent link Url
Declaration
public static string ChangeGuid(string url, Guid guid)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | url | The URL. |
| System.Guid | guid | The GUID. |
Returns
| Type | Description |
|---|---|
| System.String |
FindContentReference(Guid)
Tries to find a content reference given a Guid.
Declaration
public static ContentReference FindContentReference(Guid guid)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Guid | guid | The GUID. |
Returns
| Type | Description |
|---|---|
| ContentReference |
FindContentReference(Guid, IPermanentLinkMapper)
Tries to find a content reference given a Guid.
Declaration
public static ContentReference FindContentReference(Guid guid, IPermanentLinkMapper permanentLinkMapper)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Guid | guid | The GUID. |
| IPermanentLinkMapper | permanentLinkMapper | The permanent link mapper. |
Returns
| Type | Description |
|---|---|
| ContentReference | Reference to content, or null if not found |
FindGuid(ContentReference)
Tries to find a GUID given a page reference
Declaration
public static Guid FindGuid(ContentReference contentLink)
Parameters
| Type | Name | Description |
|---|---|---|
| ContentReference | contentLink | The page reference. |
Returns
| Type | Description |
|---|---|
| System.Guid | A valid link map, or null if not found |
FindGuid(ContentReference, IPermanentLinkMapper)
Tries to find a GUID given a page reference
Declaration
public static Guid FindGuid(ContentReference contentLink, IPermanentLinkMapper permanentLinkMapper)
Parameters
| Type | Name | Description |
|---|---|---|
| ContentReference | contentLink | The page reference. |
| IPermanentLinkMapper | permanentLinkMapper | The permanent link mapper. |
Returns
| Type | Description |
|---|---|
| System.Guid | A valid link map, or null if not found |
GetGuid(Url)
Gets the GUID part from a permanent link
Declaration
public static Guid GetGuid(Url url)
Parameters
| Type | Name | Description |
|---|---|---|
| Url | url | The URL. |
Returns
| Type | Description |
|---|---|
| System.Guid | The Guid from the link or Guid.Empty if it was no proper permanent link |
GetGuid(Url, out String)
Gets the GUID part from a permanent link
Declaration
public static Guid GetGuid(Url url, out string extension)
Parameters
| Type | Name | Description |
|---|---|---|
| Url | url | The URL. |
| System.String | extension | The extension. |
Returns
| Type | Description |
|---|---|
| System.Guid | The Guid from the link or Guid.Empty if it was no proper permanent link |
GetGuid(UrlBuilder, out String)
Gets the GUID from a permanent link.
Declaration
public static Guid GetGuid(UrlBuilder url, out string extension)
Parameters
| Type | Name | Description |
|---|---|---|
| UrlBuilder | url | The permanent link, must be an absolute Uri, a root-relative Uri or an app-relative Uri |
| System.String | extension | The extension from the permanent link |
Returns
| Type | Description |
|---|---|
| System.Guid |
Remarks
The only method to produce a corrent permanent link is via the method GetPermanentLinkUrl()
GetGuid(String)
Gets the GUID from an permanent link that may be expressed as virtualPath, a root-relative Url, an app-relative Url or as an absolulte Url.
Declaration
public static Guid GetGuid(string virtualPathOrUrl)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | virtualPathOrUrl | The virtual path or URL. |
Returns
| Type | Description |
|---|---|
| System.Guid |
GetGuid(String, out String)
Gets the GUID part from a permanent link
Declaration
public static Guid GetGuid(string virtualPathOrUrl, out string extension)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | virtualPathOrUrl | The virtual path or URL. |
| System.String | extension | The extension. |
Returns
| Type | Description |
|---|---|
| System.Guid | The Guid from the link or Guid.Empty if it was no proper permanent link |
GetPermanentLinkUrl(Guid, String)
Gets a permanent link URL representation by building it. No lookup is performed.
Declaration
public static Uri GetPermanentLinkUrl(Guid guid, string extension)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Guid | guid | The GUID. |
| System.String | extension | The extension. |
Returns
| Type | Description |
|---|---|
| System.Uri | The permanent link Url representing this Guid and extension |
Remarks
The instances returned should be treated as opaque units. Do not parse or interpret the contents.
GetPermanentLinkVirtualPath(Guid, String)
Gets a permanent link virtual path representation by building it. No lookup is performed.
Declaration
public static string GetPermanentLinkVirtualPath(Guid guid, string extension)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Guid | guid | The GUID. |
| System.String | extension | The extension. |
Returns
| Type | Description |
|---|---|
| System.String | The permanent link virtual path representing this Guid and extension |
Remarks
The instances returned should be treated as opaque units. Do not parse or interpret the contents.
TryParseGuid(String, out Guid)
Tries to get the get Guid from a string.
Declaration
public static bool TryParseGuid(string g, out Guid guid)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | g | The Guid string. |
| System.Guid | guid | The Guid, or Guid.Empty if it was not possible to get a Guid. |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if a valid guid was detected. |