SaaS CMS has officially launched! Learn more now.

Class VirtualPathHandler

Controls the initialization and setup of the virtual path providers.

Inheritance
System.Object
VirtualPathHandler
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.Hosting
Assembly: EPiServer.dll
Version: 8.11.0
Syntax
public class VirtualPathHandler

Properties

CustomFileSummary

Custom file summary (same for all filesystem VPP's.) May change in the furure...

Declaration
[Obsolete("Custom file summary setting is moved to VirtualPathUnifiedProvider parameters.", true)]
public string CustomFileSummary { get; }
Property Value
Type Description
System.String

Instance

Singleton pattern Class instance accessor property.

Declaration
public static VirtualPathHandler Instance { get; set; }
Property Value
Type Description
VirtualPathHandler

NameToVirtualPathMapping

Gets the generics dictionary with the mappings between the VirtualName and the VirtualPath. Example as key is "Upload" and the value as "~/upload".

Declaration
public IDictionary<string, string> NameToVirtualPathMapping { get; }
Property Value
Type Description
System.Collections.Generic.IDictionary<System.String, System.String>

PageDirectoryRootVirtualPath

Gets the VirtuaPath to the provider responsible for handling Page files.

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

PageFolderProvider

Gets the page folder virtual path provider.

Declaration
public static VirtualPathProvider PageFolderProvider { get; }
Property Value
Type Description
System.Web.Hosting.VirtualPathProvider

The page folder provider.

PhysicalPageDirectory

Physical directory for page folder directory.

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

Physical absolute path to the page folder directory, guaranteed to always end with "&quot;.

Examples

"F:\sitedata\upload&quot;

VirtualPathProviders

Gets the virtual path providers.

Declaration
public IDictionary<VirtualPathProvider, ProviderSettings> VirtualPathProviders { get; }
Property Value
Type Description
System.Collections.Generic.IDictionary<System.Web.Hosting.VirtualPathProvider, System.Configuration.ProviderSettings>

The virtual path providers.

VirtualPathToNameMapping

Gets the generics dictionary with the mappings between the VirtualPath and the VirtualName. Example as key is "~/upload" and the value as "Upload".

Declaration
public IDictionary<string, string> VirtualPathToNameMapping { get; }
Property Value
Type Description
System.Collections.Generic.IDictionary<System.String, System.String>

Methods

GetDirectory(String, Boolean)

Make it possible to request a directory without any access check perfomed That is to be compared with call to System.Web.Hosting.VirtualPathProvider.GetDirectory(System.String) which will check that current user has been granted AccessLevel.Read

Declaration
public VirtualDirectory GetDirectory(string virtualPath, bool bypassAccessControl)
Parameters
Type Name Description
System.String virtualPath

The virtual path.

System.Boolean bypassAccessControl

if set to true no access control is performed

Returns
Type Description
System.Web.Hosting.VirtualDirectory

the directory

GetFile(String, Boolean)

Make it possible to request a file without any access check perfomed That is to be compared with call to System.Web.Hosting.VirtualPathProvider.GetFile(System.String) which will check that current user has been granted AccessLevel.Read

Declaration
public VirtualFile GetFile(string virtualPath, bool bypassAccessControl)
Parameters
Type Name Description
System.String virtualPath

The virtual path.

System.Boolean bypassAccessControl

if set to true no access control is performed

Returns
Type Description
System.Web.Hosting.VirtualFile

The file.

GetInstance(IContentLoader, LocalizationService, IContentProviderManager, IPageQuickSearch)

Singleton pattern Class instance accessor method with dependency injection property.

Declaration
public static VirtualPathHandler GetInstance(IContentLoader contentQueryable, LocalizationService localizationService, IContentProviderManager pageProviderManager, IPageQuickSearch pageQuickSearch)
Parameters
Type Name Description
IContentLoader contentQueryable

The content queryable.

LocalizationService localizationService

The EPiServer.Web.Hosting.VirtualPathHandler.LocalizationService used by the instance.

IContentProviderManager pageProviderManager

The page enterprise service.

IPageQuickSearch pageQuickSearch

The page quick search.

Returns
Type Description
VirtualPathHandler

GetProvider(String)

Gets a virtual path provider based on it's name.

Declaration
public static VirtualPathProvider GetProvider(string providername)
Parameters
Type Name Description
System.String providername

The providername.

Returns
Type Description
System.Web.Hosting.VirtualPathProvider

A virtual path provider

InitializeProviders(IDictionary<VirtualPathProvider, ProviderSettings>)

Attempts to initialize CMS VPP providers which have been instantiated and registered by VirtualPathRegistrationHandler.

Declaration
public void InitializeProviders(IDictionary<VirtualPathProvider, ProviderSettings> providers)
Parameters
Type Name Description
System.Collections.Generic.IDictionary<System.Web.Hosting.VirtualPathProvider, System.Configuration.ProviderSettings> providers

InitializeProviders(IDictionary<VirtualPathProvider, ProviderSettings>, Boolean)

Attempts to initialize CMS VPP providers which have been instantiated and registered by VirtualPathRegistrationHandler.

Declaration
public void InitializeProviders(IDictionary<VirtualPathProvider, ProviderSettings> providers, bool captureCustomExceptions)
Parameters
Type Name Description
System.Collections.Generic.IDictionary<System.Web.Hosting.VirtualPathProvider, System.Configuration.ProviderSettings> providers

The providers.

System.Boolean captureCustomExceptions

if set to true then exceptions from initialization of non-built in providers are captured

IsVirtualPath(String)

Determines whether the given virtual path exists in any of the registered vpp:s.

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

The virtual path.

Returns
Type Description
System.Boolean

true if the given virtual path exists in any of the registered vpp:s; otherwise, false.

NameForProvider(VirtualPathProvider)

Get the name for the provider.

Declaration
public static string NameForProvider(VirtualPathProvider virtualPathProvider)
Parameters
Type Name Description
System.Web.Hosting.VirtualPathProvider virtualPathProvider

The virtual path provider to get the name for.

Returns
Type Description
System.String

SetBypassAccessCheck(ProviderSettingsCollection)

Sets the bypass access check settings for providers in collection.

Declaration
public static void SetBypassAccessCheck(ProviderSettingsCollection providers)
Parameters
Type Name Description
System.Configuration.ProviderSettingsCollection providers

The providers.

ValidateCharacters(UnifiedDirectory, UnifiedVirtualPathEventArgs)

Declaration
public void ValidateCharacters(UnifiedDirectory sender, UnifiedVirtualPathEventArgs e)
Parameters
Type Name Description
UnifiedDirectory sender
UnifiedVirtualPathEventArgs e

ValidateCharacters(UnifiedFile, UnifiedVirtualPathEventArgs)

Standard event listener for

Declaration
public void ValidateCharacters(UnifiedFile sender, UnifiedVirtualPathEventArgs e)
Parameters
Type Name Description
UnifiedFile sender
UnifiedVirtualPathEventArgs e

ValidateCharacters(String, out String)

Validates the characters in virtual path from virtual path unified provider.

Declaration
public bool ValidateCharacters(string virtualPath, out string illegalCharactersDisplayString)
Parameters
Type Name Description
System.String virtualPath

The virtual path that should be validated.

System.String illegalCharactersDisplayString

The illegal characters display string.

Returns
Type Description
System.Boolean

true if the specified virtual path is valid and does not contain illegal characters; otherwise, false.

VirtualPathForProvider(VirtualPathProvider)

Get the name for the provider.

Declaration
public static string VirtualPathForProvider(VirtualPathProvider virtualPathProvider)
Parameters
Type Name Description
System.Web.Hosting.VirtualPathProvider virtualPathProvider

The virtual path provider to get the name for.

Returns
Type Description
System.String

Extension Methods