2020-01-28 13:41:54 +01:00
using System ;
2019-11-20 13:38:41 +01:00
namespace Umbraco.Core.Hosting
{
public interface IHostingEnvironment
{
string SiteName { get ; }
2020-12-08 10:42:26 +11:00
2019-11-20 13:38:41 +01:00
string ApplicationId { get ; }
2020-04-21 13:07:20 +10:00
/// <summary>
/// Will return the physical path to the root of the application
/// </summary>
2019-11-20 13:38:41 +01:00
string ApplicationPhysicalPath { get ; }
string LocalTempPath { get ; }
2020-04-03 11:03:06 +11:00
/// <summary>
/// The web application's hosted path
/// </summary>
/// <remarks>
/// In most cases this will return "/" but if the site is hosted in a virtual directory then this will return the virtual directory's path such as "/mysite".
/// This value must begin with a "/" and cannot end with "/".
/// </remarks>
2019-11-20 15:21:09 +01:00
string ApplicationVirtualPath { get ; }
bool IsDebugMode { get ; }
2020-04-03 11:03:06 +11:00
2019-12-04 14:03:39 +01:00
/// <summary>
/// Gets a value indicating whether Umbraco is hosted.
/// </summary>
2019-11-20 15:21:09 +01:00
bool IsHosted { get ; }
2020-04-03 11:03:06 +11:00
2020-04-21 13:07:20 +10:00
/// <summary>
/// Maps a virtual path to a physical path to the application's web root
/// </summary>
/// <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.
/// </remarks>
2020-05-04 14:40:11 +02:00
string MapPathWebRoot ( string path ) ;
/// <summary>
/// Maps a virtual path to a physical path to the application's root (not always equal to the web root)
/// </summary>
/// <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.
/// </remarks>
string MapPathContentRoot ( string path ) ;
2020-04-03 01:08:52 +11:00
/// <summary>
2020-04-21 13:07:20 +10:00
/// Converts a virtual path to an absolute URL path based on the application's web root
2020-04-03 01:08:52 +11:00
/// </summary>
/// <param name="virtualPath">The virtual path. Must start with either ~/ or / else an exception is thrown.</param>
/// <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
2020-04-03 09:17:40 +11:00
/// map to "/site/pages/test" where "/site" is the value of <see cref="ApplicationVirtualPath"/>.
2020-04-03 01:08:52 +11:00
/// </remarks>
/// <exception cref="InvalidOperationException">
/// If virtualPath does not start with ~/ or /
/// </exception>
2020-04-03 09:17:40 +11:00
string ToAbsolute ( string virtualPath ) ;
2019-11-20 13:38:41 +01:00
}
}