Class VirtualPathUtilityEx
Inheritance
Inherited Members
Namespace: EPiServer.Web
Assembly: EPiServer.Framework.dll
Version: 8.11.0Syntax
public static class VirtualPathUtilityEx
Fields
AppDataPathKey
Declaration
public const string AppDataPathKey = "[appDataPath]"
Field Value
Type | Description |
---|---|
System.String |
Methods
Combine(String, String)
Combines a base path and a relative path, but works in a non ASP.NET-hosted environment, and assumes that the relative path is relative - even if it begins with a slash.
Declaration
public static string Combine(string basePath, string relativePath)
Parameters
Type | Name | Description |
---|---|---|
System.String | basePath | The base path. |
System.String | relativePath | The relative path. |
Returns
Type | Description |
---|---|
System.String | The combined basePath and relativePath. |
Remarks
Extends System.Web.VirtualPathUtility.Combine(System.String,System.String) to make it work in a non ASP.NET-hosted environment. Also allows all combos of trailing slash on basePath and leading on relativePath (i.e. will treat a 'faulty' relative path starting with a slash as a relative anyway. This is formally incorrect, but pragmatically useful due to other EPiServer API:s that for historical reasons work with such 'rooted' paths.
GetExtension(String)
Gets the extension for a file referenced in the virtual path.
Declaration
public static string GetExtension(string virtualPath)
Parameters
Type | Name | Description |
---|---|---|
System.String | virtualPath | The virtual path. |
Returns
Type | Description |
---|---|
System.String |
Remarks
Extends System.Web.VirtualPathUtility.GetExtension(System.String) to make it work in a non ASP.NET-hosted environment.
IsValidVirtualPath(String)
Determines whether the given candidate has a valid virtual path syntax.
Declaration
public static bool IsValidVirtualPath(string candidate)
Parameters
Type | Name | Description |
---|---|---|
System.String | candidate | The candidate virtual path string. |
Returns
Type | Description |
---|---|
System.Boolean |
|
RebasePhysicalPath(String)
Rebases the physical path according to the AppDataPathKey value, environment variables and relative paths.
Declaration
public static string RebasePhysicalPath(string path)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | The path. |
Returns
Type | Description |
---|---|
System.String |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | if the path contains AppDataPathKey and the it's value is not configured in the config file. |
ToAbsolute(String)
Converts a virtual path to an application absolute path.
Declaration
public static string ToAbsolute(string virtualPath)
Parameters
Type | Name | Description |
---|---|---|
System.String | virtualPath | The virtual path to convert to an application-relative path |
Returns
Type | Description |
---|---|
System.String | The absolute path representation of the specified virtual path. |
Remarks
Extends System.Web.VirtualPathUtility.ToAbsolute(System.String,System.String) to make it work in a non ASP.NET-hosted environment.
ToAppRelative(String)
Converts a virtual path to an application-relative path.
Declaration
public static string ToAppRelative(string virtualPath)
Parameters
Type | Name | Description |
---|---|---|
System.String | virtualPath | The virtual path to convert to an application-relative path. |
Returns
Type | Description |
---|---|
System.String | The application-relative path representation of virtualPath. |
Remarks
Extends System.Web.VirtualPathUtility.ToAppRelative(System.String,System.String) to make it work in a non ASP.NET-hosted environment.
ValidatePhysicalPath(String)
Validates the physical path for the specified path string.
Declaration
public static void ValidatePhysicalPath(string physicalPath)
Parameters
Type | Name | Description |
---|---|---|
System.String | physicalPath | The physical path. |
Remarks
Throw ArgumentException If the physicalPath is different from the full path.