Class PageReference
Holds references to pages in the EPiServer system.
Implements
Inherited Members
Namespace: EPiServer.Core
Assembly: EPiServer.dll
Version: 12.0.3Syntax
public class PageReference : ContentReference, IComparable, IReadOnly<ContentReference>, IComparable<ContentReference>, IEquatable<ContentReference>, IReadOnly<PageReference>, IReadOnly
Remarks
Instead of using raw integer IDs, the ID is packaged in a PageReference structure. A page can have several versions and even be located on another physical server. This information is also stored inside the structure.
Constructors
PageReference()
Initializes a new instance of the Page
Declaration
public PageReference()
PageReference(ContentReference)
Initializes a new instance of the Page
Declaration
public PageReference(ContentReference contentLink)
Parameters
Type | Name | Description |
---|---|---|
Content |
contentLink |
PageReference(Int32)
Initialize a new Page
Declaration
public PageReference(int pageID)
Parameters
Type | Name | Description |
---|---|---|
System. |
pageID | The Page ID to set |
PageReference(Int32, Boolean)
Initialize a new Page
Declaration
public PageReference(int pageID, bool anyVersion)
Parameters
Type | Name | Description |
---|---|---|
System. |
pageID | The page id to set |
System. |
anyVersion | This parameter is not used, see remarks |
PageReference(Int32, Int32)
Initialize a new Page
Declaration
public PageReference(int pageID, int workPageID)
Parameters
Type | Name | Description |
---|---|---|
System. |
pageID | The page id to set |
System. |
workPageID | The work id to set |
PageReference(Int32, Int32, String)
Initialize a new Page
Declaration
public PageReference(int pageID, int workPageID, string remoteSite)
Parameters
Type | Name | Description |
---|---|---|
System. |
pageID | The page id to set |
System. |
workPageID | The version to set |
System. |
remoteSite | The name of the remote site |
PageReference(Int32, Int32, String, Boolean)
Initialize a new Page
Declaration
public PageReference(int pageID, int workPageID, string remoteSite, bool anyVersion)
Parameters
Type | Name | Description |
---|---|---|
System. |
pageID | The page id to set |
System. |
workPageID | The version to set |
System. |
remoteSite | The name of the remote site |
System. |
anyVersion | This parameter is not used, see remarks |
PageReference(Int32, String)
Initialize a new Page
Declaration
public PageReference(int pageID, string remoteSite)
Parameters
Type | Name | Description |
---|---|---|
System. |
pageID | The page id to set |
System. |
remoteSite | The name of the remote site |
PageReference(String)
Initialize a new Page
Declaration
public PageReference(string complexReference)
Parameters
Type | Name | Description |
---|---|---|
System. |
complexReference | The string containing page information |
Exceptions
Type | Condition |
---|---|
EPi |
Thrown if the string cannot be parsed as a valid PageReference. |
Fields
EmptyReference
Returns an empty Page
Declaration
public static readonly PageReference EmptyReference
Field Value
Type | Description |
---|---|
Page |
SelfReference
Returns a Page
Declaration
public static readonly PageReference SelfReference
Field Value
Type | Description |
---|---|
Page |
Methods
Copy()
Copies this instance.
Declaration
public PageReference Copy()
Returns
Type | Description |
---|---|
Page |
CreateWritableClone()
Create a copy of the current object instance that is writable.
Declaration
public PageReference CreateWritableClone()
Returns
Type | Description |
---|---|
Page |
A new copy of the object. |
Remarks
The cloning is a deep-copy.
IsNullOrEmpty(PageReference)
Determines whether the specified page link is null or empty.
Declaration
public static bool IsNullOrEmpty(PageReference pageLink)
Parameters
Type | Name | Description |
---|---|---|
Page |
pageLink | The page link. |
Returns
Type | Description |
---|---|
System. |
|
IsValue(PageReference)
Determines whether the passed Page
Declaration
public static bool IsValue(PageReference pageLink)
Parameters
Type | Name | Description |
---|---|---|
Page |
pageLink | The Page |
Returns
Type | Description |
---|---|
System. |
|
Parse(String)
Parse and return a Page
Declaration
public static PageReference Parse(string s)
Parameters
Type | Name | Description |
---|---|---|
System. |
s | The string, in the format pageID[_workID[_remoteSite]]. |
Returns
Type | Description |
---|---|
Page |
The PageReference, or PageReference.EmptyReference if it's invalid |
Exceptions
Type | Condition |
---|---|
EPi |
If string is not parsable as a pagereference |
ParseUrl(String)
Parse a url for PageLink. It is assumed that the url is root-relative, i.e. starts with a "/".
Declaration
public static PageReference ParseUrl(string url)
Parameters
Type | Name | Description |
---|---|---|
System. |
url | Url to parse, assumed to start with "/" |
Returns
Type | Description |
---|---|
Page |
A PageReference or PageReference.EmptyReference if it's not a valid reference |
Remarks
In order to successfully parse a FURL with ParserUrl, first convert the FURL to an internal url - use the UrlRewriteProvider.ConvertToInternal method.
TryParse(String, out PageReference)
Create a new Page
Declaration
public static bool TryParse(string complexReference, out PageReference result)
Parameters
Type | Name | Description |
---|---|---|
System. |
complexReference | The string containing page information. |
Page |
result | The PageReference created from the string. |
Returns
Type | Description |
---|---|
System. |
True if parsing was successful. |