View Source
  Class UrlHelperExtensions
  
  
  
  
    Inheritance
      System.Object
      
   
  
  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
  
    
      
        | Type | Name | Description | 
    
    
      
        | IHostingEnvironment | hostingEnvironment |  | 
      
        | IUmbracoVersion | umbracoVersion |  | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | System.String |  | 
    
  
  
    View Source
  
  GetCropUrl(IUrlHelper, Nullable<ImageCropperValue>, String, Nullable<Int32>, Nullable<Int32>, Nullable<Int32>, Nullable<ImageCropMode>, Nullable<ImageCropAnchor>, Boolean, Boolean, String, String, Boolean)
  
  
  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 | 
    
    
      
        | Microsoft.AspNetCore.Mvc.IUrlHelper | urlHelper |  | 
      
        | System.Nullable<ImageCropperValue> | imageCropperValue |  | 
      
        | System.String | cropAlias |  | 
      
        | System.Nullable<System.Int32> | width |  | 
      
        | System.Nullable<System.Int32> | height |  | 
      
        | System.Nullable<System.Int32> | quality |  | 
      
        | System.Nullable<ImageCropMode> | imageCropMode |  | 
      
        | System.Nullable<ImageCropAnchor> | imageCropAnchor |  | 
      
        | System.Boolean | preferFocalPoint |  | 
      
        | System.Boolean | useCropDimensions |  | 
      
        | System.String | cacheBusterValue |  | 
      
        | System.String | furtherOptions |  | 
      
        | System.Boolean | htmlEncode |  | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | Microsoft.AspNetCore.Html.IHtmlContent |  | 
    
  
  
    View Source
  
  GetCropUrl(IUrlHelper, Nullable<IPublishedContent>, Nullable<Int32>, Nullable<Int32>, String, String, Nullable<Int32>, Nullable<ImageCropMode>, Nullable<ImageCropAnchor>, Boolean, Boolean, Boolean, String, Boolean, UrlMode)
  
  
  Declaration
  
    public static IHtmlContent GetCropUrl(this IUrlHelper urlHelper, IPublishedContent? mediaItem, int? width = null, int? height = null, string propertyAlias = null, 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 = null)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Microsoft.AspNetCore.Mvc.IUrlHelper | urlHelper |  | 
      
        | System.Nullable<IPublishedContent> | mediaItem |  | 
      
        | System.Nullable<System.Int32> | width |  | 
      
        | System.Nullable<System.Int32> | height |  | 
      
        | System.String | propertyAlias |  | 
      
        | System.String | cropAlias |  | 
      
        | System.Nullable<System.Int32> | quality |  | 
      
        | System.Nullable<ImageCropMode> | imageCropMode |  | 
      
        | System.Nullable<ImageCropAnchor> | imageCropAnchor |  | 
      
        | System.Boolean | preferFocalPoint |  | 
      
        | System.Boolean | useCropDimensions |  | 
      
        | System.Boolean | cacheBuster |  | 
      
        | System.String | furtherOptions |  | 
      
        | System.Boolean | htmlEncode |  | 
      
        | UrlMode | urlMode |  | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | Microsoft.AspNetCore.Html.IHtmlContent |  | 
    
  
  
    View Source
  
  GetCropUrl(IUrlHelper, Nullable<IPublishedContent>, String, Boolean, UrlMode)
  
  
  Declaration
  
    public static IHtmlContent GetCropUrl(this IUrlHelper urlHelper, IPublishedContent? mediaItem, string cropAlias, bool htmlEncode = true, UrlMode urlMode = null)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Microsoft.AspNetCore.Mvc.IUrlHelper | urlHelper |  | 
      
        | System.Nullable<IPublishedContent> | mediaItem |  | 
      
        | System.String | cropAlias |  | 
      
        | System.Boolean | htmlEncode |  | 
      
        | UrlMode | urlMode |  | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | Microsoft.AspNetCore.Html.IHtmlContent |  | 
    
  
  
    View Source
  
  GetCropUrl(IUrlHelper, Nullable<IPublishedContent>, String, String, Boolean, UrlMode)
  
  
  Declaration
  
    public static IHtmlContent GetCropUrl(this IUrlHelper urlHelper, IPublishedContent? mediaItem, string propertyAlias, string cropAlias, bool htmlEncode = true, UrlMode urlMode = null)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Microsoft.AspNetCore.Mvc.IUrlHelper | urlHelper |  | 
      
        | System.Nullable<IPublishedContent> | mediaItem |  | 
      
        | System.String | propertyAlias |  | 
      
        | System.String | cropAlias |  | 
      
        | System.Boolean | htmlEncode |  | 
      
        | UrlMode | urlMode |  | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | Microsoft.AspNetCore.Html.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 | 
    
    
      
        | Microsoft.AspNetCore.Mvc.IUrlHelper | url |  | 
      
        | System.String | actionName |  | 
      
        | System.String | controllerName |  | 
      
        | System.Object | id |  | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | System.String |  | 
    
  
  
    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 | 
    
    
      
        | Microsoft.AspNetCore.Mvc.IUrlHelper | url |  | 
      
        | System.String | actionName |  | 
      
        | System.String | controllerName |  | 
      
        | System.String | area |  | 
      
        | System.Object | id |  | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | System.String |  | 
    
  
  
    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 | 
    
    
      
        | Microsoft.AspNetCore.Mvc.IUrlHelper | url |  | 
      
        | System.String | actionName |  | 
      
        | System.String | controllerName |  | 
      
        | Microsoft.AspNetCore.Routing.RouteValueDictionary | routeVals |  | 
      
        | IHostingEnvironment | hostingEnvironment |  | 
      
        | IUmbracoVersion | umbracoVersion |  | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | System.String |  | 
    
  
  
    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 | 
    
    
      
        | Microsoft.AspNetCore.Mvc.IUrlHelper | url |  | 
      
        | IUmbracoContext | umbracoContext |  | 
      
        | Microsoft.AspNetCore.DataProtection.IDataProtectionProvider | dataProtectionProvider |  | 
      
        | System.String | action |  | 
      
        | System.String | controllerName |  | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | System.String |  | 
    
  
  
    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 | 
    
    
      
        | Microsoft.AspNetCore.Mvc.IUrlHelper | url |  | 
      
        | IUmbracoContext | umbracoContext |  | 
      
        | Microsoft.AspNetCore.DataProtection.IDataProtectionProvider | dataProtectionProvider |  | 
      
        | System.String | action |  | 
      
        | System.String | controllerName |  | 
      
        | System.Object | additionalRouteVals |  | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | System.String |  | 
    
  
  
    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 | 
    
    
      
        | Microsoft.AspNetCore.Mvc.IUrlHelper | url |  | 
      
        | IUmbracoContext | umbracoContext |  | 
      
        | Microsoft.AspNetCore.DataProtection.IDataProtectionProvider | dataProtectionProvider |  | 
      
        | System.String | action |  | 
      
        | System.String | controllerName |  | 
      
        | System.String | area |  | 
      
        | System.Object | additionalRouteVals |  | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | System.String |  |