Class UrlHelperPreviewExtensions
Provides extension methods for the UrlHelperExtensionPoint.
public static class UrlHelperPreviewExtensions
- Inheritance
-
objectUrlHelperPreviewExtensions
Methods
ApplyPreviewContext(UrlHelperExtensionPoint, string)
Extends the given url
by information about the current website channel and preview mode
when used within the Kentico Xperience administration UI (Page builder, Page preview).
public static string ApplyPreviewContext(this UrlHelperExtensionPoint instance, string url)
Parameters
instance
UrlHelperExtensionPointThe object that provides methods to build URLs to Kentico content.
url
stringURL that is to be extended. The following URL formats will be extended: Relative (virtual) or absolute path.
Returns
- string
The
url
extended by the preview information when used within the Kentico Xperience administration UI, otherwise the originalurl
.
Remarks
Use this method within your MVC site codebase only. It is not intended for use in UI components and UI pages of the Kentico Xperience administration UI.
Exceptions
- ArgumentNullException
instance
is null.- ArgumentException
url
is null or empty.
AuthenticateUrl(UrlHelperExtensionPoint, string)
Extends the given url
by additional authentication information when the current request carries authentication information in the request URL.
[Obsolete("Use Kentico.Content.Web.Mvc.UrlHelperPreviewExtensions.ApplyPreviewContext(string) instead.")]
[ObsoleteSince(29, 6)]
public static IHtmlContent AuthenticateUrl(this UrlHelperExtensionPoint instance, string url)
Parameters
instance
UrlHelperExtensionPointThe object that provides methods to build URLs to Kentico content.
url
stringURL that is to be authenticated. The following URL formats will be authenticated: Relative (virtual) or absolute path. Query string parameters are not secured and can be changed even after the
url
is authenticated.
Returns
- IHtmlContent
If the current request carries authentication information in the URL, returns the given
url
extended by authentication information. If the current request does not carry authentication information in the URL, returns the originalurl
.
Remarks
The return type of Microsoft.AspNetCore.Html.IHtmlContent indicates that the return value should not be HTML encoded, otherwise it may loose its query string parameters due to encoded '&' character
Exceptions
- ArgumentNullException
instance
is null.- ArgumentException
url
is null or empty.
AuthenticateUrl(UrlHelperExtensionPoint, string, bool)
Extends the given url
by additional authentication information when the current request carries authentication information in the request URL.
[Obsolete("Use Kentico.Content.Web.Mvc.UrlHelperPreviewExtensions.ApplyPreviewContext(string) instead.")]
[ObsoleteSince(29, 6)]
public static IHtmlContent AuthenticateUrl(this UrlHelperExtensionPoint instance, string url, bool readonlyMode)
Parameters
instance
UrlHelperExtensionPointThe object that provides methods to build URLs to Kentico content.
url
stringURL that is to be authenticated. The following URL formats will be authenticated: Relative (virtual) or absolute path. Query string parameters are not secured and can be changed even after the
url
is authenticated.readonlyMode
boolIndicates if read-only mode should be enabled to disallow modify actions and POST requests.
Returns
- IHtmlContent
If the current request carries authentication information in the URL, returns the given
url
extended by authentication information. If the current request does not carry authentication information in the URL, returns the originalurl
.
Remarks
The return type of Microsoft.AspNetCore.Html.IHtmlContent indicates that the return value should not be HTML encoded, otherwise it may loose its query string parameters due to encoded '&' character
Exceptions
- ArgumentNullException
instance
is null.- ArgumentException
url
is null or empty.
AuthenticateUrlRaw(UrlHelperExtensionPoint, string)
Extends the given url
by additional authentication information when the current request carries authentication information in the request URL.
[Obsolete("Use Kentico.Content.Web.Mvc.UrlHelperPreviewExtensions.ApplyPreviewContext(string) instead.")]
[ObsoleteSince(29, 6)]
public static string AuthenticateUrlRaw(this UrlHelperExtensionPoint instance, string url)
Parameters
instance
UrlHelperExtensionPointThe object that provides methods to build URLs to Kentico content.
url
stringURL that is to be authenticated. The following URL formats will be authenticated: Relative (virtual) or absolute path. Query string parameters are not secured and can be changed even after the
url
is authenticated.
Returns
- string
If the current request carries authentication information in the URL, returns the given
url
extended by authentication information. If the current request does not carry authentication information in the URL, returns the originalurl
.
Exceptions
- ArgumentNullException
instance
is null.- ArgumentException
url
is null or empty.
AuthenticateUrlRaw(UrlHelperExtensionPoint, string, bool)
Extends the given url
by additional authentication information when the current request carries authentication information in the request URL.
[Obsolete("Use Kentico.Content.Web.Mvc.UrlHelperPreviewExtensions.ApplyPreviewContext(string) instead.")]
[ObsoleteSince(29, 6)]
public static string AuthenticateUrlRaw(this UrlHelperExtensionPoint instance, string url, bool readonlyMode)
Parameters
instance
UrlHelperExtensionPointThe object that provides methods to build URLs to Kentico content.
url
stringURL that is to be authenticated. The following URL formats will be authenticated: Relative (virtual) or absolute path. Query string parameters are not secured and can be changed even after the
url
is authenticated.readonlyMode
boolIndicates if read-only mode should be enabled to disallow modify actions and POST requests.
Returns
- string
If the current request carries authentication information in the URL, returns the given
url
extended by authentication information. If the current request does not carry authentication information in the URL, returns the originalurl
.
Exceptions
- ArgumentNullException
instance
is null.- ArgumentException
url
is null or empty.