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. |
url | The URL. |
System. |
guid | The GUID. |
Returns
Type | Description |
---|---|
System. |
FindContentReference(Guid)
Tries to find a content reference given a Guid.
Declaration
public static ContentReference FindContentReference(Guid guid)
Parameters
Type | Name | Description |
---|---|---|
System. |
guid | The GUID. |
Returns
Type | Description |
---|---|
Content |
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 | The GUID. |
IPermanent |
permanentLinkMapper | The permanent link mapper. |
Returns
Type | Description |
---|---|
Content |
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 |
---|---|---|
Content |
contentLink | The page reference. |
Returns
Type | Description |
---|---|
System. |
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 |
---|---|---|
Content |
contentLink | The page reference. |
IPermanent |
permanentLinkMapper | The permanent link mapper. |
Returns
Type | Description |
---|---|
System. |
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. |
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. |
extension | The extension. |
Returns
Type | Description |
---|---|
System. |
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 |
---|---|---|
Url |
url | The permanent link, must be an absolute Uri, a root-relative Uri or an app-relative Uri |
System. |
extension | The extension from the permanent link |
Returns
Type | Description |
---|---|
System. |
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. |
virtualPathOrUrl | The virtual path or URL. |
Returns
Type | Description |
---|---|
System. |
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. |
virtualPathOrUrl | The virtual path or URL. |
System. |
extension | The extension. |
Returns
Type | Description |
---|---|
System. |
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 | The GUID. |
System. |
extension | The extension. |
Returns
Type | Description |
---|---|
System. |
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 | The GUID. |
System. |
extension | The extension. |
Returns
Type | Description |
---|---|
System. |
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. |
g | The Guid string. |
System. |
guid | The Guid, or Guid.Empty if it was not possible to get a Guid. |
Returns
Type | Description |
---|---|
System. |
true if a valid guid was detected. |