View Source
Class UrlHelperExtensions
Assembly: Umbraco.Web.Common.dll
Syntax
public static class UrlHelperExtensions
Methods
View Source
GetCacheBustHash(IHostingEnvironment, IUmbracoVersion)
Declaration
public static string GetCacheBustHash(IHostingEnvironment hostingEnvironment, IUmbracoVersion umbracoVersion)
Parameters
Returns
View Source
GetCropUrl(IUrlHelper, IPublishedContent?, int?, int?, string, string?, int?, ImageCropMode?, ImageCropAnchor?, bool, bool, bool, string?, bool, UrlMode)
Declaration
public static IHtmlContent GetCropUrl(this IUrlHelper urlHelper, IPublishedContent? mediaItem, int? width = null, int? height = null, string propertyAlias = "umbracoFile", string? cropAlias = null, int? quality = null, ImageCropMode? imageCropMode = null, ImageCropAnchor? imageCropAnchor = null, bool preferFocalPoint = false, bool useCropDimensions = false, bool cacheBuster = true, string? furtherOptions = null, bool htmlEncode = true, UrlMode urlMode = UrlMode.Default)
Parameters
| Type |
Name |
Description |
| IUrlHelper |
urlHelper |
|
| IPublishedContent |
mediaItem |
|
| int? |
width |
|
| int? |
height |
|
| string |
propertyAlias |
|
| string |
cropAlias |
|
| int? |
quality |
|
| ImageCropMode? |
imageCropMode |
|
| ImageCropAnchor? |
imageCropAnchor |
|
| bool |
preferFocalPoint |
|
| bool |
useCropDimensions |
|
| bool |
cacheBuster |
|
| string |
furtherOptions |
|
| bool |
htmlEncode |
|
| UrlMode |
urlMode |
|
Returns
| Type |
Description |
| IHtmlContent |
|
View Source
GetCropUrl(IUrlHelper, IPublishedContent?, string, bool, UrlMode)
Declaration
public static IHtmlContent GetCropUrl(this IUrlHelper urlHelper, IPublishedContent? mediaItem, string cropAlias, bool htmlEncode = true, UrlMode urlMode = UrlMode.Default)
Parameters
Returns
| Type |
Description |
| IHtmlContent |
|
View Source
GetCropUrl(IUrlHelper, IPublishedContent?, string, string, bool, UrlMode)
Declaration
public static IHtmlContent GetCropUrl(this IUrlHelper urlHelper, IPublishedContent? mediaItem, string propertyAlias, string cropAlias, bool htmlEncode = true, UrlMode urlMode = UrlMode.Default)
Parameters
| Type |
Name |
Description |
| IUrlHelper |
urlHelper |
|
| IPublishedContent |
mediaItem |
|
| string |
propertyAlias |
|
| string |
cropAlias |
|
| bool |
htmlEncode |
|
| UrlMode |
urlMode |
|
Returns
| Type |
Description |
| IHtmlContent |
|
View Source
GetCropUrl(IUrlHelper, ImageCropperValue?, string, int?, int?, int?, ImageCropMode?, ImageCropAnchor?, bool, bool, string?, string?, bool)
Declaration
public static IHtmlContent GetCropUrl(this IUrlHelper urlHelper, ImageCropperValue? imageCropperValue, string cropAlias, int? width = null, int? height = null, int? quality = null, ImageCropMode? imageCropMode = null, ImageCropAnchor? imageCropAnchor = null, bool preferFocalPoint = false, bool useCropDimensions = true, string? cacheBusterValue = null, string? furtherOptions = null, bool htmlEncode = true)
Parameters
| Type |
Name |
Description |
| IUrlHelper |
urlHelper |
|
| ImageCropperValue |
imageCropperValue |
|
| string |
cropAlias |
|
| int? |
width |
|
| int? |
height |
|
| int? |
quality |
|
| ImageCropMode? |
imageCropMode |
|
| ImageCropAnchor? |
imageCropAnchor |
|
| bool |
preferFocalPoint |
|
| bool |
useCropDimensions |
|
| string |
cacheBusterValue |
|
| string |
furtherOptions |
|
| bool |
htmlEncode |
|
Returns
| Type |
Description |
| IHtmlContent |
|
View Source
GetUmbracoApiService(IUrlHelper, string, string, object?)
Return the Url for a Web Api service
Declaration
public static string? GetUmbracoApiService(this IUrlHelper url, string actionName, string controllerName, object? id = null)
Parameters
| Type |
Name |
Description |
| IUrlHelper |
url |
|
| string |
actionName |
|
| string |
controllerName |
|
| object |
id |
|
Returns
View Source
GetUmbracoApiService(IUrlHelper, string, string, string, object?)
Return the Url for a Web Api service
Declaration
public static string? GetUmbracoApiService(this IUrlHelper url, string actionName, string controllerName, string area, object? id = null)
Parameters
| Type |
Name |
Description |
| IUrlHelper |
url |
|
| string |
actionName |
|
| string |
controllerName |
|
| string |
area |
|
| object |
id |
|
Returns
View Source
GetUrlWithCacheBust(IUrlHelper, string, string, RouteValueDictionary, IHostingEnvironment, IUmbracoVersion)
Return the Url for an action with a cache-busting hash appended
Declaration
public static string GetUrlWithCacheBust(this IUrlHelper url, string actionName, string controllerName, RouteValueDictionary routeVals, IHostingEnvironment hostingEnvironment, IUmbracoVersion umbracoVersion)
Parameters
| Type |
Name |
Description |
| IUrlHelper |
url |
|
| string |
actionName |
|
| string |
controllerName |
|
| RouteValueDictionary |
routeVals |
|
| IHostingEnvironment |
hostingEnvironment |
|
| IUmbracoVersion |
umbracoVersion |
|
Returns
View Source
SurfaceAction(IUrlHelper, IUmbracoContext, IDataProtectionProvider, string, string)
Generates a URL based on the current Umbraco URL with a custom query string that will route to the specified
SurfaceController
Declaration
public static string SurfaceAction(this IUrlHelper url, IUmbracoContext umbracoContext, IDataProtectionProvider dataProtectionProvider, string action, string controllerName)
Parameters
| Type |
Name |
Description |
| IUrlHelper |
url |
|
| IUmbracoContext |
umbracoContext |
|
| IDataProtectionProvider |
dataProtectionProvider |
|
| string |
action |
|
| string |
controllerName |
|
Returns
View Source
SurfaceAction(IUrlHelper, IUmbracoContext, IDataProtectionProvider, string, string, object?)
Generates a URL based on the current Umbraco URL with a custom query string that will route to the specified
SurfaceController
Declaration
public static string SurfaceAction(this IUrlHelper url, IUmbracoContext umbracoContext, IDataProtectionProvider dataProtectionProvider, string action, string controllerName, object? additionalRouteVals)
Parameters
| Type |
Name |
Description |
| IUrlHelper |
url |
|
| IUmbracoContext |
umbracoContext |
|
| IDataProtectionProvider |
dataProtectionProvider |
|
| string |
action |
|
| string |
controllerName |
|
| object |
additionalRouteVals |
|
Returns
View Source
SurfaceAction(IUrlHelper, IUmbracoContext, IDataProtectionProvider, string, string, string, object?)
Generates a URL based on the current Umbraco URL with a custom query string that will route to the specified
SurfaceController
Declaration
public static string SurfaceAction(this IUrlHelper url, IUmbracoContext umbracoContext, IDataProtectionProvider dataProtectionProvider, string action, string controllerName, string area, object? additionalRouteVals)
Parameters
| Type |
Name |
Description |
| IUrlHelper |
url |
|
| IUmbracoContext |
umbracoContext |
|
| IDataProtectionProvider |
dataProtectionProvider |
|
| string |
action |
|
| string |
controllerName |
|
| string |
area |
|
| object |
additionalRouteVals |
|
Returns