• Core
  • Infrastructure
  • Web
  • Extensions
Search Results for

    Show / Hide Table of Contents
    View Source

    Class UrlHelperExtensions

    Inheritance
    System.Object
    Namespace: Umbraco.Extensions
    Assembly: Umbraco.Web.Common.dll
    Syntax
    public static class UrlHelperExtensions

    Methods

    View Source

    GetBackOfficeUrl(IUrlHelper)

    Return the back office url if the back office is installed

    Declaration
    public static string GetBackOfficeUrl(this IUrlHelper url)
    Parameters
    Type Name Description
    Microsoft.AspNetCore.Mvc.IUrlHelper url
    Returns
    Type Description
    System.String
    Remarks

    This method contained a bug that would result in always returning "/".

    View Source

    GetCacheBustHash(IHostingEnvironment, IUmbracoVersion, IRuntimeMinifier)

    Declaration
    public static string GetCacheBustHash(IHostingEnvironment hostingEnvironment, IUmbracoVersion umbracoVersion, IRuntimeMinifier runtimeMinifier)
    Parameters
    Type Name Description
    IHostingEnvironment hostingEnvironment
    IUmbracoVersion umbracoVersion
    IRuntimeMinifier runtimeMinifier
    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

    GetUmbracoApiService(IUrlHelper, UmbracoApiControllerTypeCollection, String, Type, Object)

    Return the Url for a Web Api service

    Declaration
    public static string GetUmbracoApiService(this IUrlHelper url, UmbracoApiControllerTypeCollection umbracoApiControllerTypeCollection, string actionName, Type apiControllerType, object id = null)
    Parameters
    Type Name Description
    Microsoft.AspNetCore.Mvc.IUrlHelper url
    UmbracoApiControllerTypeCollection umbracoApiControllerTypeCollection
    System.String actionName
    Type apiControllerType
    System.Object id
    Returns
    Type Description
    System.String
    View Source

    GetUmbracoApiService<T>(IUrlHelper, UmbracoApiControllerTypeCollection, Expression<Func<T, Object>>)

    Declaration
    public static string GetUmbracoApiService<T>(this IUrlHelper url, UmbracoApiControllerTypeCollection umbracoApiControllerTypeCollection, Expression<Func<T, object>> methodSelector)
        where T : UmbracoApiController
    Parameters
    Type Name Description
    Microsoft.AspNetCore.Mvc.IUrlHelper url
    UmbracoApiControllerTypeCollection umbracoApiControllerTypeCollection
    System.Linq.Expressions.Expression<Func<T, System.Object>> methodSelector
    Returns
    Type Description
    System.String
    Type Parameters
    Name Description
    T
    View Source

    GetUmbracoApiService<T>(IUrlHelper, UmbracoApiControllerTypeCollection, String, Object)

    Return the Url for a Web Api service

    Declaration
    public static string GetUmbracoApiService<T>(this IUrlHelper url, UmbracoApiControllerTypeCollection umbracoApiControllerTypeCollection, string actionName, object id = null)
        where T : UmbracoApiController
    Parameters
    Type Name Description
    Microsoft.AspNetCore.Mvc.IUrlHelper url
    UmbracoApiControllerTypeCollection umbracoApiControllerTypeCollection
    System.String actionName
    System.Object id
    Returns
    Type Description
    System.String
    Type Parameters
    Name Description
    T
    View Source

    GetUmbracoApiServiceBaseUrl<T>(IUrlHelper, UmbracoApiControllerTypeCollection, Expression<Func<T, Object>>)

    Declaration
    public static string GetUmbracoApiServiceBaseUrl<T>(this IUrlHelper url, UmbracoApiControllerTypeCollection umbracoApiControllerTypeCollection, Expression<Func<T, object>> methodSelector)
        where T : UmbracoApiController
    Parameters
    Type Name Description
    Microsoft.AspNetCore.Mvc.IUrlHelper url
    UmbracoApiControllerTypeCollection umbracoApiControllerTypeCollection
    System.Linq.Expressions.Expression<Func<T, System.Object>> methodSelector
    Returns
    Type Description
    System.String
    Type Parameters
    Name Description
    T
    View Source

    GetUmbracoApiServiceBaseUrl<T>(IUrlHelper, UmbracoApiControllerTypeCollection, String)

    Return the Base Url (not including the action) for a Web Api service

    Declaration
    public static string GetUmbracoApiServiceBaseUrl<T>(this IUrlHelper url, UmbracoApiControllerTypeCollection umbracoApiControllerTypeCollection, string actionName)
        where T : UmbracoApiController
    Parameters
    Type Name Description
    Microsoft.AspNetCore.Mvc.IUrlHelper url
    UmbracoApiControllerTypeCollection umbracoApiControllerTypeCollection
    System.String actionName
    Returns
    Type Description
    System.String
    Type Parameters
    Name Description
    T
    View Source

    GetUmbracoBackOfficeUrl(IUrlHelper)

    Gets the Umbraco backoffice URL (if Umbraco is installed).

    Declaration
    public static string GetUmbracoBackOfficeUrl(this IUrlHelper urlHelper)
    Parameters
    Type Name Description
    Microsoft.AspNetCore.Mvc.IUrlHelper urlHelper

    The URL helper.

    Returns
    Type Description
    System.String

    The Umbraco backoffice URL.

    View Source

    GetUrlWithCacheBust(IUrlHelper, String, String, RouteValueDictionary, IHostingEnvironment, IUmbracoVersion, IRuntimeMinifier)

    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, IRuntimeMinifier runtimeMinifier)
    Parameters
    Type Name Description
    Microsoft.AspNetCore.Mvc.IUrlHelper url
    System.String actionName
    System.String controllerName
    Microsoft.AspNetCore.Routing.RouteValueDictionary routeVals
    IHostingEnvironment hostingEnvironment
    IUmbracoVersion umbracoVersion
    IRuntimeMinifier runtimeMinifier
    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
    • Improve this Doc
    • View Source
    In This Article
    • Methods
      • GetBackOfficeUrl(IUrlHelper)
      • GetCacheBustHash(IHostingEnvironment, IUmbracoVersion, IRuntimeMinifier)
      • GetCropUrl(IUrlHelper, Nullable<ImageCropperValue>, String, Nullable<Int32>, Nullable<Int32>, Nullable<Int32>, Nullable<ImageCropMode>, Nullable<ImageCropAnchor>, Boolean, Boolean, String, String, Boolean)
      • GetCropUrl(IUrlHelper, Nullable<IPublishedContent>, Nullable<Int32>, Nullable<Int32>, String, String, Nullable<Int32>, Nullable<ImageCropMode>, Nullable<ImageCropAnchor>, Boolean, Boolean, Boolean, String, Boolean, UrlMode)
      • GetCropUrl(IUrlHelper, Nullable<IPublishedContent>, String, Boolean, UrlMode)
      • GetCropUrl(IUrlHelper, Nullable<IPublishedContent>, String, String, Boolean, UrlMode)
      • GetUmbracoApiService(IUrlHelper, String, String, Object)
      • GetUmbracoApiService(IUrlHelper, String, String, String, Object)
      • GetUmbracoApiService(IUrlHelper, UmbracoApiControllerTypeCollection, String, Type, Object)
      • GetUmbracoApiService<T>(IUrlHelper, UmbracoApiControllerTypeCollection, Expression<Func<T, Object>>)
      • GetUmbracoApiService<T>(IUrlHelper, UmbracoApiControllerTypeCollection, String, Object)
      • GetUmbracoApiServiceBaseUrl<T>(IUrlHelper, UmbracoApiControllerTypeCollection, Expression<Func<T, Object>>)
      • GetUmbracoApiServiceBaseUrl<T>(IUrlHelper, UmbracoApiControllerTypeCollection, String)
      • GetUmbracoBackOfficeUrl(IUrlHelper)
      • GetUrlWithCacheBust(IUrlHelper, String, String, RouteValueDictionary, IHostingEnvironment, IUmbracoVersion, IRuntimeMinifier)
      • SurfaceAction(IUrlHelper, IUmbracoContext, IDataProtectionProvider, String, String)
      • SurfaceAction(IUrlHelper, IUmbracoContext, IDataProtectionProvider, String, String, Object)
      • SurfaceAction(IUrlHelper, IUmbracoContext, IDataProtectionProvider, String, String, String, Object)
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX