Bewerken

Share via


VirtualPathProvider.Previous Property

Definition

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

protected public:
 property System::Web::Hosting::VirtualPathProvider ^ Previous { System::Web::Hosting::VirtualPathProvider ^ get(); };
protected internal System.Web.Hosting.VirtualPathProvider Previous { get; }
member this.Previous : System.Web.Hosting.VirtualPathProvider
Protected Friend ReadOnly Property Previous As VirtualPathProvider

Property Value

The next VirtualPathProvider object in the compilation system.

Examples

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);
}
Public Overrides Function GetFile(ByVal virtualPath As String) As VirtualFile
  If (IsPathVirtual(virtualPath)) Then
    Return New SampleVirtualFile(virtualPath, Me)
  Else
    Return Previous.GetFile(virtualPath)
  End If
End Function

Remarks

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.

Applies to