Search Results for

    Show / Hide Table of Contents
    View Source

    Class AspNetCoreHostingEnvironment

    Inheritance
    System.Object
    Namespace: Umbraco.Cms.Web.Common.AspNetCore
    Assembly: Umbraco.Web.Common.dll
    Syntax
    public class AspNetCoreHostingEnvironment : IHostingEnvironment

    Constructors

    View Source

    AspNetCoreHostingEnvironment(IServiceProvider, IOptionsMonitor<HostingSettings>, IOptionsMonitor<WebRoutingSettings>, IWebHostEnvironment)

    Declaration
    public AspNetCoreHostingEnvironment(IServiceProvider serviceProvider, IOptionsMonitor<HostingSettings> hostingSettings, IOptionsMonitor<WebRoutingSettings> webRoutingSettings, IWebHostEnvironment webHostEnvironment)
    Parameters
    Type Name Description
    IServiceProvider serviceProvider
    Microsoft.Extensions.Options.IOptionsMonitor<HostingSettings> hostingSettings
    Microsoft.Extensions.Options.IOptionsMonitor<WebRoutingSettings> webRoutingSettings
    Microsoft.AspNetCore.Hosting.IWebHostEnvironment webHostEnvironment
    View Source

    AspNetCoreHostingEnvironment(IOptionsMonitor<HostingSettings>, IOptionsMonitor<WebRoutingSettings>, IWebHostEnvironment)

    Declaration
    public AspNetCoreHostingEnvironment(IOptionsMonitor<HostingSettings> hostingSettings, IOptionsMonitor<WebRoutingSettings> webRoutingSettings, IWebHostEnvironment webHostEnvironment)
    Parameters
    Type Name Description
    Microsoft.Extensions.Options.IOptionsMonitor<HostingSettings> hostingSettings
    Microsoft.Extensions.Options.IOptionsMonitor<WebRoutingSettings> webRoutingSettings
    Microsoft.AspNetCore.Hosting.IWebHostEnvironment webHostEnvironment
    View Source

    AspNetCoreHostingEnvironment(IOptionsMonitor<HostingSettings>, IOptionsMonitor<WebRoutingSettings>, IWebHostEnvironment, IApplicationDiscriminator)

    Declaration
    public AspNetCoreHostingEnvironment(IOptionsMonitor<HostingSettings> hostingSettings, IOptionsMonitor<WebRoutingSettings> webRoutingSettings, IWebHostEnvironment webHostEnvironment, IApplicationDiscriminator applicationDiscriminator)
    Parameters
    Type Name Description
    Microsoft.Extensions.Options.IOptionsMonitor<HostingSettings> hostingSettings
    Microsoft.Extensions.Options.IOptionsMonitor<WebRoutingSettings> webRoutingSettings
    Microsoft.AspNetCore.Hosting.IWebHostEnvironment webHostEnvironment
    Microsoft.AspNetCore.DataProtection.Infrastructure.IApplicationDiscriminator applicationDiscriminator

    Properties

    View Source

    ApplicationId

    The unique application ID for this Umbraco website.

    Declaration
    public string ApplicationId { get; }
    Property Value
    Type Description
    System.String
    Remarks

    The returned value will be the same consistent value for an Umbraco website on a specific server and will the same between restarts of that Umbraco website/application on that specific server.

    The value of this does not distinguish between unique workers/servers for this Umbraco application. Usage of this must take into account that the same ApplicationId may be returned for the same Umbraco website hosted on different servers.
    Similarly the usage of this must take into account that a different ApplicationId may be returned for the same Umbraco website hosted on different servers.

    This returns a hash of the value of IApplicationDiscriminator.Discriminator (which is most likely just the value of unless an alternative implementation of IApplicationDiscriminator has been registered).
    However during ConfigureServices a temporary instance of IHostingEnvironment is constructed which guarantees that this will be the hash of , so the value may differ depend on when the property is used.

    If you require this value during ConfigureServices it is probably a code smell.

    View Source

    ApplicationMainUrl

    Declaration
    public Uri ApplicationMainUrl { get; }
    Property Value
    Type Description
    Uri
    View Source

    ApplicationPhysicalPath

    Will return the physical path to the root of the application

    Declaration
    public string ApplicationPhysicalPath { get; }
    Property Value
    Type Description
    System.String
    View Source

    ApplicationVirtualPath

    Declaration
    public string ApplicationVirtualPath { get; }
    Property Value
    Type Description
    System.String
    View Source

    IISVersion

    Declaration
    public Version? IISVersion { get; }
    Property Value
    Type Description
    System.Nullable<Version>
    View Source

    IsDebugMode

    Declaration
    public bool IsDebugMode { get; }
    Property Value
    Type Description
    System.Boolean
    View Source

    IsHosted

    Gets a value indicating whether Umbraco is hosted.

    Declaration
    public bool IsHosted { get; }
    Property Value
    Type Description
    System.Boolean
    View Source

    LocalTempPath

    Declaration
    public string LocalTempPath { get; }
    Property Value
    Type Description
    System.String
    View Source

    SiteName

    Declaration
    public string SiteName { get; }
    Property Value
    Type Description
    System.String

    Methods

    View Source

    EnsureApplicationMainUrl(Nullable<Uri>)

    Declaration
    public void EnsureApplicationMainUrl(Uri? currentApplicationUrl)
    Parameters
    Type Name Description
    System.Nullable<Uri> currentApplicationUrl
    View Source

    MapPathContentRoot(String)

    Maps a virtual path to a physical path to the application's root (not always equal to the web root)

    Declaration
    public string MapPathContentRoot(string path)
    Parameters
    Type Name Description
    System.String path
    Returns
    Type Description
    System.String
    Remarks

    Depending on the runtime 'web root', this result can vary. For example in Net Framework the web root and the content root are the same, however in netcore the web root is /www therefore this will Map to a physical path within www.

    View Source

    MapPathWebRoot(String)

    Maps a virtual path to a physical path to the application's web root

    Declaration
    public string MapPathWebRoot(string path)
    Parameters
    Type Name Description
    System.String path
    Returns
    Type Description
    System.String
    Remarks

    Depending on the runtime 'web root', this result can vary. For example in Net Framework the web root and the content root are the same, however in netcore the web root is /www therefore this will Map to a physical path within www.

    View Source

    ToAbsolute(String)

    Converts a virtual path to an absolute URL path based on the application's web root

    Declaration
    public string ToAbsolute(string virtualPath)
    Parameters
    Type Name Description
    System.String virtualPath

    The virtual path. Must start with either ~/ or / else an exception is thrown.

    Returns
    Type Description
    System.String
    Remarks

    This maps the virtual path syntax to the web root. For example when hosting in a virtual directory called "site" and the value "~/pages/test" is passed in, it will map to "/site/pages/test" where "/site" is the value of ApplicationVirtualPath.

    • Improve this Doc
    • View Source
    In This Article
    • Constructors
      • AspNetCoreHostingEnvironment(IServiceProvider, IOptionsMonitor<HostingSettings>, IOptionsMonitor<WebRoutingSettings>, IWebHostEnvironment)
      • AspNetCoreHostingEnvironment(IOptionsMonitor<HostingSettings>, IOptionsMonitor<WebRoutingSettings>, IWebHostEnvironment)
      • AspNetCoreHostingEnvironment(IOptionsMonitor<HostingSettings>, IOptionsMonitor<WebRoutingSettings>, IWebHostEnvironment, IApplicationDiscriminator)
    • Properties
      • ApplicationId
      • ApplicationMainUrl
      • ApplicationPhysicalPath
      • ApplicationVirtualPath
      • IISVersion
      • IsDebugMode
      • IsHosted
      • LocalTempPath
      • SiteName
    • Methods
      • EnsureApplicationMainUrl(Nullable<Uri>)
      • MapPathContentRoot(String)
      • MapPathWebRoot(String)
      • ToAbsolute(String)
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX