Class VirtualPathNonUnifiedProvider
This class is used for relocating folders outside physical application root. Typical usage is to separate portions of the the EPiServer UI files from the site files.
Inheritance
Namespace: EPiServer.Web.Hosting
Assembly: EPiServer.Framework.dll
Version: 10.10.4Syntax
public class VirtualPathNonUnifiedProvider : VirtualPathProvider
Constructors
VirtualPathNonUnifiedProvider(String, NameValueCollection)
Creates an instance of a VirtualPathNonUnifiedProvider.
Declaration
public VirtualPathNonUnifiedProvider(string providerName, NameValueCollection configParameters)
Parameters
Type | Name | Description |
---|---|---|
System.String | providerName | The provider name as specified in the VirtualPathProviders section in the configuration. |
System.Collections.Specialized.NameValueCollection | configParameters | A dictionary containing all configuration parameters as specified in the configuration file. |
VirtualPathNonUnifiedProvider(String, NameValueCollection, IVirtualPathResolver)
Creates an instance of a VirtualPathNonUnifiedProvider.
Declaration
public VirtualPathNonUnifiedProvider(string providerName, NameValueCollection configParameters, IVirtualPathResolver virtualPathResolver)
Parameters
Type | Name | Description |
---|---|---|
System.String | providerName | The provider name as specified in the VirtualPathProviders section in the configuration. |
System.Collections.Specialized.NameValueCollection | configParameters | A dictionary containing all configuration parameters as specified in the configuration file. |
IVirtualPathResolver | virtualPathResolver | The virtual path provider |
Properties
ConfigurationParameters
Gets the collection of configuration parameters for the virtual path provider.
Declaration
public NameValueCollection ConfigurationParameters { get; }
Property Value
Type | Description |
---|---|
System.Collections.Specialized.NameValueCollection |
LocalPath
Gets the physical path mapping to the virtual path root.
Declaration
public string LocalPath { get; }
Property Value
Type | Description |
---|---|
System.String |
ProviderName
Gets the name of the virtual path provider.
Declaration
public string ProviderName { get; }
Property Value
Type | Description |
---|---|
System.String |
VirtualPathRoot
Gets the virtual path root. Only paths starting with this are handled by this provider.
Declaration
public string VirtualPathRoot { get; protected set; }
Property Value
Type | Description |
---|---|
System.String | The virtual path root, always ending with a /. |
Methods
DirectoryExists(String)
Gets a value that indicates whether a directory exists in the virtual file system.
Declaration
public override bool DirectoryExists(string virtualDir)
Parameters
Type | Name | Description |
---|---|---|
System.String | virtualDir | The virtual path. |
Returns
Type | Description |
---|---|
System.Boolean | true if the directory exists in the virtual file system, otherwise false. |
FileExists(String)
Gets a value that indicates whether a file exists in the virtual file system.
Declaration
public override bool FileExists(string virtualPath)
Parameters
Type | Name | Description |
---|---|---|
System.String | virtualPath | The virtual path. |
Returns
Type | Description |
---|---|
System.Boolean | true if the file exists in the virtual file system, otherwise false. |
GetCacheDependency(String, IEnumerable, DateTime)
Creates a cache dependency based on the specified virtual paths.
Declaration
public override CacheDependency GetCacheDependency(string virtualPath, IEnumerable virtualPathDependencies, DateTime utcStart)
Parameters
Type | Name | Description |
---|---|---|
System.String | virtualPath | The path to the primary virtual resource. |
System.Collections.IEnumerable | virtualPathDependencies | An array of paths to other resources required by the primary virtual resource. |
System.DateTime | utcStart | The UTC time at which the virtual resources were read. |
Returns
Type | Description |
---|---|
System.Web.Caching.CacheDependency | A System.Web.Caching.CacheDependency object for the specified virtual resources. |
Remarks
virtualPathDependencies has to be an System.Collections.IEnumerable of System.String. All the elements that are not strings will be ignored. No exception will be thrown.
GetDirectory(String)
Gets a directory from the virtual filesystem.
Declaration
public override VirtualDirectory GetDirectory(string virtualDir)
Parameters
Type | Name | Description |
---|---|---|
System.String | virtualDir | The virtual path. |
Returns
Type | Description |
---|---|
System.Web.Hosting.VirtualDirectory | A System.Web.Hosting.VirtualDirectory object representing the virtual path. |
Remarks
If the specified virtual path is not handled by the current virtual path provider the next provider in the provider chain is queried.
GetFile(String)
Gets a file from the virtual filesystem.
Declaration
public override VirtualFile GetFile(string virtualPath)
Parameters
Type | Name | Description |
---|---|---|
System.String | virtualPath | The virtual path. |
Returns
Type | Description |
---|---|
System.Web.Hosting.VirtualFile | A System.Web.Hosting.VirtualFile object representing the virtual path. |
Remarks
If the specified virtual path is not handled by the current virtual path provider the next provider in the provider chain is queried.
GetFileHash(String, IEnumerable)
Returns a hash for the file found at the specified virtual path and its dependencies.
Declaration
public override string GetFileHash(string virtualPath, IEnumerable virtualPathDependencies)
Parameters
Type | Name | Description |
---|---|---|
System.String | virtualPath | The path to the primary virtual resource. |
System.Collections.IEnumerable | virtualPathDependencies | An array of paths to other virtual resources required by the primary virtual resource. |
Returns
Type | Description |
---|---|
System.String | A hash of the files specified in the virtual path dependencies. |
MapPathInternal(DirectoryInfo, String)
Maps a virtual path to it's corresponding physical path, given a physical path base.
Declaration
protected string MapPathInternal(DirectoryInfo physicalPathBase, string virtualPath)
Parameters
Type | Name | Description |
---|---|---|
System.IO.DirectoryInfo | physicalPathBase | The base physical path. |
System.String | virtualPath | The virtual path. |
Returns
Type | Description |
---|---|
System.String | A physical path |
Remarks
The implementation expects that virtualPath is a absoulte virtualPath starting with the path this provider instance is registered with. Validation can be performed by TryGetHandledAbsolutePath(String, out String)
MapVirtualPathToLocalPath(String, out String)
Maps a virtual (relative) path to an local absolute path
Declaration
public bool MapVirtualPathToLocalPath(string virtualPath, out string outLocalPath)
Parameters
Type | Name | Description |
---|---|---|
System.String | virtualPath | the virtual path |
System.String | outLocalPath | returned local absolute path |
Returns
Type | Description |
---|---|
System.Boolean | True if virtual path was mapped successfully to an absolute path within the namespace of this provider, false otherwise |
Remarks
Note that this function does not check if the file actually exists, it only cares about path mapping
TryGetHandledAbsolutePath(String, out String)
Tries to get the absolute path.
Declaration
protected bool TryGetHandledAbsolutePath(string virtualPath, out string handledPath)
Parameters
Type | Name | Description |
---|---|---|
System.String | virtualPath | The virtual path. |
System.String | handledPath | The resulting absolute path. |
Returns
Type | Description |
---|---|
System.Boolean | True if the virtual path is handled by the current provider. |