Class VirtualPathHelper

Contains utlility methods when working with virtual paths

Inheritance
System.Object
VirtualPathHelper
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Web
Assembly: EPiServer.Framework.AspNet.dll
Version: 11.20.7
Syntax
public static class VirtualPathHelper

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.

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

true if the string is not null or empty and has a valid virtual path syntax; otherwise, false.