Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

VirtualPathProvider.Previous Property

Gets a reference to a previously registered VirtualPathProvider object in the compilation system.

Namespace:  System.Web.Hosting
Assembly:  System.Web (in System.Web.dll)
protected internal VirtualPathProvider Previous { get; }

Property Value

Type: System.Web.Hosting.VirtualPathProvider
The next VirtualPathProvider object in the compilation system.

When a VirtualPathProvider object is registered with the ASP.NET compilation system, it is added to a chain of providers. Use the Previous property to hand processing off to the previous VirtualPathProvider object in the chain if the requested path is not provided by this VirtualPathProvider instance.

The chain of path providers always ends with the default ASP.NET provider, which serves files from the file system.

The following code example is an implementation of the GetFile method. If the requested virtual directory does not begin with the string "/vrdir", the method uses the Previous property to pass the request to the next VirtualPathProvider object in the chain. For the full code required to run the example, see the Example section of the VirtualPathProvider class overview topic.

public override VirtualFile GetFile(string virtualPath)
{
  if (IsPathVirtual(virtualPath))
    return new SampleVirtualFile(virtualPath, this);
  else 
    return Previous.GetFile(virtualPath);
}

.NET Framework

Supported in: 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft. All rights reserved.