Class IWebPageFieldsSourceExtensions
Extension methods over IWebPageFieldsSource.
public static class IWebPageFieldsSourceExtensions
- Inheritance
-
objectIWebPageFieldsSourceExtensions
Methods
GetUrl(IWebPageFieldsSource)
Retrieves the URL for a web page represented by a model that implements the IWebPageFieldsSource interface.
public static WebPageUrl GetUrl(this IWebPageFieldsSource webPageFieldsSource)
Parameters
webPageFieldsSource
IWebPageFieldsSourceThe web page model that implements IWebPageFieldsSource.
Returns
Remarks
This method relies on existing data obtained during the data retrieval operation and, unlike IWebPageUrlRetriever never attempts to query the database for additional information when resolving the URL.
The model on which this method is called must be obtained via content query (CMS.ContentEngine.ContentQueryExecutor), which ensures all data required for URL resolution. Failure to use a model obtained via content query may result in an exception.
For multilingual website channels, if you need to preserve the language in the URL for web pages that do not have a translation in the requested language, use the 'ForWebsite' or 'WithWebPageData' methods, followed by 'SetUrlLanguageBehavior', specifying UseRequestedLanguage.
If you are limiting the columns in your query via Columns(params string[]), ensure you include all columns required for URL construction by using the UrlPathColumns(ContentTypeQueryParameters) extension method.
Exceptions
- ArgumentNullException
Thrown if
webPageFieldsSource
isnull
.- ArgumentException
Thrown if SystemFields in
webPageFieldsSource
isnull
.- InvalidOperationException
Thrown in the following cases:
- The
webPageFieldsSource
model does not contain the web page identifier or content language identifier within its SystemFields property. - The web page identified by WebPageItemID (within SystemFields) does not exist.
- The